2014年4月4日星期五

zz Preprocessor Statements #ifdef, #else, #endif

Preprocessor Statements #ifdef, #else, #endif

These provide a rapid way to "clip" out and insert code.
Consider;

     #define FIRST

     main()
     {
        int a, b, c;

#ifdef FIRST
       a=2; b=6; c=4;
#else
       printf("Enter a:");
       scanf("%d", &a);
     
       printf("Enter a:");
       scanf("%d", &a);

       printf("Enter a:");
       scanf("%d", &a);
#endif
       additonal code
Note that if FIRST is defined (which it is in the above) the values of a, b and c are hardcoded to values of 2, 6 and 4. This can save a lot of time when developing software as it avoids tediously typing everything in each and everytime you run your routine. When FIRST is defined, all that is passed to the compiler is the code between the #ifdef and the #else. The code between the #else and the #endif is not seen by the compiler. It is as if it were all a comment.
Once you have your routine working, and desire to insert the printf and scanfs, all that is required is to go back and delete the the #define FIRST. Now, the compiler does not see the;

     a=2; b=6; c=4;
statement, but does see the printf and scanfs.


Quite often you will have code which doesn't work, but you really don't want to throw it away. I see many students doing this;

/*
     unwanted code
*/
And this is acceptable. Of course a problem arises is you have a comment in the unwanted code.
Thus, it is better to do this

#ifdef OLD
     unwanted code
#endif
Note that if there is no #define OLD, the unwanted code is not passed to the compiler.

2013年4月19日星期五

Signal and Image Processing with Wavelets

https://www.ceremade.dauphine.fr/~peyre/teaching/wavelets/

The main reference for an indepth explanation of Wavelet processing is

Stéphane Mallat, Academic Press; 2 edition (September 15, 1999)

Each one of these five lectures should take between 1h and 2h in order to test the various features of the scripts. One should copy/paste the provided code into a file named e.g. tp1.m, and launch the script directly from Matlab comand line > tp1;. Some of the scripts contain "holes" that you should try to fill on your own.

I also provide the complete correction of these lectures as a set of Matlab scripts, but you should try as much as possible to avoid using them.
-
Basic Matlab instructions.
-
Linear and non-linear wavelet approximation of signals.
-
Linear and non-linear wavelet approximation of images.
-
Denoising using filtering.
-
Denoising using wavelet thresholding.
-
Wavelet compression of 1D signals.
-
Image Compression.

Collect and plot data from an instrument in real time



Collect and plot data from an instrument in real time

Controlling Instruments and Serial Devices with MATLAB and Simulink [Webinar]


Serial Interface (RS-232 and RS-485) and MATLAB

2012年12月15日星期六

DFTS-OFDM for uplink transmission in LTE (ZZ)

Today multi-carrier transmission and OFDM are means to allow for very high overall transmission bandwidth while still being robust to signal corruption due to radio-channel frequency selectivity. However, a drawback of OFDM modulation, as well as any kind of multi-carrier transmission, is the large variations in the instantaneous power of the transmitted signal. Such power variations imply a reduced power-amplifier efficiency and higher power-amplifier cost. This is especially critical for the uplink, due to the high importance of low mobile-terminal power consumption and cost. Several methods have been proposed on how to reduce the large power variations of an OFDM signal. However, most of these methods have limitations in terms of to what extent the power variations can be reduced. Furthermore, most of the methods also imply a significant computational complexity and/or a reduced link performance. Thus, there is an interest to consider also wider-band single-carrier transmission as an alternative to multi-carrier transmission, especially for the uplink, i.e. for mobile-terminal transmission. One of such single-carrier transmission scheme can be implemented using DFT-spread OFDM

DFT-spread OFDM (DFTS-OFDM) is a transmission scheme that can combine the desired properties for uplink transmission i.e. : 
• Small variations in the instantaneous power of the transmitted signal (‘single carrier’ property). 
• Possibility for low-complexity high-quality equalization in the frequency domain. 
• Possibility for FDMA with flexible bandwidth assignment. 

Due to these properties, DFTS-OFDM has been selected as the uplink transmission scheme for LTE, which is the long-term 3G evolution.

DFTS-OFDM signal generation
PAR distribution for OFDM and DFTS-OFDM, respectively.

More detail can be accessed from here:
http://wirelesscafe.wordpress.com/2009/04/07/what-is-single-carrier-fdma-sc-fdma/