Some one help me in this.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Reema Memon
el 5 de Nov. de 2021
Respondida: Star Strider
el 5 de Nov. de 2021
%Script for parts a & b
%Part a
t1=-0.08;
t2=0.16;
ntp=1200;
us=3;
t=t1:(t2-t1)/ntp:t2;
x=80*sinc(100*t)+25*sinc(100*t-1)+90*sinc(20*t-0.8)+25*sinc(50*t-3)+80*sinc(100*t-8);
f=-100:0.1:100;
X=0.8*(1+exp(-j*0.16*pi*f)).*(us(f+50)-us(f-50))+0.5*(exp(-j*0.04*pi*f))+exp(-j*0.12*pi*f).*(us(f+25)-us(f-25))+4.5*(exp(-j*0.08*pi*f)).*(us(f+10)-us(f-10));
plotting statements
%Part b
for i=1:3
figure;
if(i==1)
T=1/75;
elseif(i==2)
T=1/100;
else
T=1/125;
end
N1=floor(t1/T)-20;
N2=ceil(t2/T)+20;
n=N1:N2;
nT=N1*T:T:N2*T;
xnT=80*sinc(100*nT)+25*sinc(100*nT-1)+90*sinc(20*nT-0.8)+25*sinc(50*nT-3)+80*sinc(100*nT-8);
tm=meshgrid(t,1:size(n,2));
nTm=meshgrid(nT,1:size(t,2))';
xnTm=meshgrid(xnT,1:size(n,2))';
xr=sum(100*T*xnTm.*sinc(100*(tm-nTm)));
plotting statements
end;
0 comentarios
Respuesta aceptada
Star Strider
el 5 de Nov. de 2021
Since ‘us’ is a scalar, any index other than 1 will throw an error.
Since the desired result is likely multiplication, and MATLAB does not recognise implicit multiplication, put the appropriate operators
X=0.8*(1+exp(-j*0.16*pi*f)).*(us(f+50)-us(f-50))+0.5*(exp(-j*0.04*pi*f))+exp(-j*0.12*pi*f).*(us(f+25)-us(f-25))+4.5*(exp(-j*0.08*pi*f)).*(us(f+10)-us(f-10));
↑ ← ↑ ←HERE ↑ ← HERE ↑ ← HERE ↑ ← Here ↑ ← AND HERE
I believe that’s all of them.
However there are still array size problems in this assignment —
xr=sum(100*T*xnTm.*sinc(100*(tm-nTm)));
so I will leave that to you to sort.
%Script for parts a & b
%Part a
t1=-0.08;
t2=0.16;
ntp=1200;
us=3;
t=t1:(t2-t1)/ntp:t2;
x=80*sinc(100*t)+25*sinc(100*t-1)+90*sinc(20*t-0.8)+25*sinc(50*t-3)+80*sinc(100*t-8);
f=-100:0.1:100;
X=0.8*(1+exp(-j*0.16*pi*f)).*(us*(f+50)-us*(f-50))+0.5*(exp(-j*0.04*pi*f))+exp(-j*0.12*pi*f).*(us*(f+25)-us*(f-25))+4.5*(exp(-j*0.08*pi*f)).*(us*(f+10)-us*(f-10));
% plotting statements
%Part b
for i=1:3
figure;
if(i==1)
T=1/75;
elseif(i==2)
T=1/100;
else
T=1/125;
end
N1=floor(t1/T)-20;
N2=ceil(t2/T)+20;
n=N1:N2;
nT=N1*T:T:N2*T;
xnT=80*sinc(100*nT)+25*sinc(100*nT-1)+90*sinc(20*nT-0.8)+25*sinc(50*nT-3)+80*sinc(100*nT-8);
tm=meshgrid(t,1:size(n,2));
nTm=meshgrid(nT,1:size(t,2))';
xnTm=meshgrid(xnT,1:size(n,2))';
xr=sum(100*T*xnTm.*sinc(100*(tm-nTm)));
% plotting statements
end;
.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!