Hi All,

I am trying to plot the power spectral density of a jittered square waveform using psd() command.The program is given below.This seems to work fine but I have problems in

[1] scaling the y-axis (the plot shows 0 - 3.6 but psd spectrum shows around 50 dB) and for some reason the grid command has no effect in this program

[2] is there any method to calculate the SNR in dB.

[3] other than unifrnd(X1,X2) are there anyother distrubution commands

that could be used.

fs20*1e6;% Sampling frequency

N24*32;

t=0:1/fs:(N-1)*1/fs;% Time vector

m=0;

for i=1:1:1024% Loop for random phase

d(i)=unifrnd(-1.0,1.0);

m=m+d(i);

end

mean=m/1024;% Mean value of duty cycle

mean

j=1;s=[];

for i = 1:1024 % Square wave generation

s=[s 1.8+1.8*square(2*pi*1e7*t(j:j+31)+d(i),50)];

j=j+32;

end

psd(s,length(t),fs,hanning(length(t)));% power spectral density

axis([0,100*1e6,0,50]);

grid;

If some thing is not clear for then plz let me know.

Best regards,

Sudhir Devarakonda

Hi All,

I am trying to plot the power spectral density of a jittered square waveform using psd() command.The program is given below.This seems to work fine but I have problems in

[1] scaling the y-axis (the plot shows 0 - 3.6 but psd spectrum shows around 50 dB) and for some reason the grid command has no effect in this program

[2] is there any method to calculate the SNR in dB.

[3] other than unifrnd(X1,X2) are there anyother distrubution commands

that could be used.

fs20*1e6;% Sampling frequency

N24*32;

t=0:1/fs:(N-1)*1/fs;% Time vector

m=0;

for i=1:1:1024% Loop for random phase

d(i)=unifrnd(-1.0,1.0);

m=m+d(i);

end

mean=m/1024;% Mean value of duty cycle

mean

j=1;s=[];

for i = 1:1024 % Square wave generation

s=[s 1.8+1.8*square(2*pi*1e7*t(j:j+31)+d(i),50)];

j=j+32;

end

psd(s,length(t),fs,hanning(length(t)));% power spectral density

axis([0,100*1e6,0,50]);

grid;

If some thing is not clear for then plz let me know.

Best regards,

Sudhir Devarakonda