To normalize the frequency of a signal from 0 to 2pi in Matlab, you can use the unwrap and angle functions. Here is an example:
main.m650 chars22 lines
In this example, we first generate a sample signal with a frequency of 50 Hz and a sampling frequency of 1000 Hz. We then normalize the amplitude of the signal to +/- 1 using the ./ operator. We then use the angle function to compute the phase angle of the signal at each time point. This phase angle is wrapped between -pi and pi, so we use the unwrap function to properly unwrap the phase angle. Finally, we divide the phase angle by 2*pi to normalize the frequency to the range of 0 to 1 (or 0 to 2pi). We plot both the original and normalized signals to verify the results.
gistlibby LogSnag