Hi, could someone please help me with the attached problem.
I'm trying to plot these signals onto Matlab but I'm not exactly sure how to.
The problem says that a, b, and c are chosen so that the sequences have unit energy. I'm not sure how to go about doing this, but here's my Matlab code so far. I get an error that my variable n is undefined. How would I define it and all the other variables?
I'm trying to plot these signals onto Matlab but I'm not exactly sure how to.
The problem says that a, b, and c are chosen so that the sequences have unit energy. I'm not sure how to go about doing this, but here's my Matlab code so far. I get an error that my variable n is undefined. How would I define it and all the other variables?
Rich (BB code):
% Signal bbox
n=4; a=1;
star=-15:0.01:15;
for x=1:length(star);
if abs(star(x))<=n
bbox(x)=a;
else
bbox(x)=0;
end;
end;
plot(star,bbox),xlabel('*'),ylabel('bbox[*]'),title('Signal bbox[*]')
;
% Signal cox
n=4; b=1;
star=-15:0.01:15;
for x=1:length(star);
if abs(star(x))<=n
cox(x)=b*cos(pi*star/n);
else
cox(x)=0;
end;
end;
plot(star,cox),xlabel('*'),ylabel('cox[*]'),title('Signal cox[*]')
% Signal c2ox
n=4; c=1;
star=-15:0.01:15;
for x=1:length(star);
if abs(star(x))<=n
c2ox(x)=c*(cos(pi*star/n))^2;
else
c2ox(x)=0;
end;
end;
plot(star,c2ox),xlabel('*'),ylabel('c2ox[*]'),title('Signal c2ox[*]')
Attachments
-
77.9 KB Views: 35
Last edited: