Matlab code for pwm and ppm

broken image
broken image

Since the individual spectral components are spaced 1 Hz apart, corresponding to the 1-Hz sinusoid, they cannot be clearly seen. Figure 3.58(a) illustrates the spectrum in the range 0 message signal is sampled at 200 samples per period or 200 Hz. In the preceding program the message signal is a sinusoid having a frequency of 1 Hz. The MATLAB code follows: % File: c3ce5.m clear all %be safe N = 20000: %FFT size N_samp - 200: % 200 samples per period f=1 % frequency beta -0.7: % modulation index period - N/N_samp % sample period (TS) Max_width-beta*N/N_samp: % maximum width y-zeros(1,N): % initialize for n-1:N_samp x = sin(2*pi*f*(n-1)/N_samp) width-(period/2) + round ((Max_width/2)*x): for k=1:Max_width nn - (n-1) period+k if k

broken image

In this computer example we determine the spectrum of a PWM signal. 1 Using the following example as a guide, develop a simulation program for PAM and PPM.

broken image