Hello sudhir,
I could not understand the first problem ie about
scaling the y axis . I executed your code, but the
plot did not show 0-3.6, however for grid command

1.Either use it before psd command or use 'grid on'
command after the psd command.I have checked it out
and getting grid and y axis is 0-50 dB.

with regards,

--- sudhir.devarakonda@sudh... wrote:
>
> 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