help in matlab code..

Status
Not open for further replies.

eng_M

Newbie level 3
Joined
Nov 25, 2010
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
hi all
how are u ?
i need help to design matlab code for
Generate a random signal (zeros and ones ) , line code it to unipolar signal , then plot its spectrum

i know how to generate random signal ones & zeros
but i need help to complete my code

thnx in advance
 

To plot spectrum you can use open-form formula of unipolar spectrum shown below:

(A^2)*Tb/4 sinc^2(f*Tb) + ((A^2)/4)*dirac(f);

Its matlab implementation:

Rb=1;
Tb=1/Rb;
f=0:0.05*Rb:2*Rb;
x=f*Tb;

P=0.5*Tb*(sinc(x).*sinc(x))+ 0.5 *dirac(f);

You can use plot (f,P) to display its spectrum. Don't forget to change bit rate for your specifications.


Regards,
Alper USLU
 

thanks for help

i made code with some friends but i have problem
i want delta fn repeated with all R not only 0,R

that the code

A=2;
Tb=1;
R=1/Tb;
L=2*R;
f=-3*L:L/50:3*L;
P=(A.^2*Tb)/16*(sinc(f*Tb/2)).^2;
g=plot(f,P);
hold on;
xlabel('Frequency');
ylabel('Normalized Power');
stem([0 R],[(A.^2*Tb)/16 P(26)+0.1]);
hold off;
set(gca,'XTickMode','manual','XTick',[-5*R,-4*R,-3*R,-2*R,-R,0,R,2*R,3*R,4*R,5*R]);
grid on;
set(gca,'YTickMode','manual','YTick',[0.5*Tb,Tb]);
set(gca,'XTickLabel',{['-5R'];['-4R'];['-3R'];['-2R'];['-R'];['0'];['R'];['2R'];['3R'];['4R'];['5R']})
set(gca,'YTickLabel',{['0.5*Tb'];['Tb']})
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…