MATLAB画周期矩形频谱
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:数学作业 时间:2024/08/03 18:12:47
MATLAB画周期矩形频谱
N=8;
>> n1=-N:-1;
>> n2=1:N;;
>> a=2;b=1;c=1;
>> c1=(a*b/(2*pi))*sin(n1*b*c)/(n1*b*c);
>> c2=a*b/(2*pi)*sin(n2*b*c)/(n2*b*c);
>> c0=a*b/(2*pi);
>> cn=[c1 c0 c2];
>> n=-N:N;
>> plot(n,cn)
运行出现?Error using ==> plot
Vectors must be the same lengths.
改错!
N=8;
>> n1=-N:-1;
>> n2=1:N;;
>> a=2;b=1;c=1;
>> c1=(a*b/(2*pi))*sin(n1*b*c)/(n1*b*c);
>> c2=a*b/(2*pi)*sin(n2*b*c)/(n2*b*c);
>> c0=a*b/(2*pi);
>> cn=[c1 c0 c2];
>> n=-N:N;
>> plot(n,cn)
运行出现?Error using ==> plot
Vectors must be the same lengths.
改错!
![MATLAB画周期矩形频谱](/uploads/image/z/7523025-33-5.jpg?t=MATLAB%E7%94%BB%E5%91%A8%E6%9C%9F%E7%9F%A9%E5%BD%A2%E9%A2%91%E8%B0%B1)
N=8;
n1=-N:-1;
n2=1:N;;
a=2;b=1;c=1;
c1=(a*b/(2*pi))*sin(n1*b*c)./(n1*b*c);%注意./与/不一样
c2=a*b/(2*pi)*sin(n2*b*c)./(n2*b*c);
c0=a*b/(2*pi);
cn=[c1 c0 c2];
n=-N:N;
plot(n,cn)
n1=-N:-1;
n2=1:N;;
a=2;b=1;c=1;
c1=(a*b/(2*pi))*sin(n1*b*c)./(n1*b*c);%注意./与/不一样
c2=a*b/(2*pi)*sin(n2*b*c)./(n2*b*c);
c0=a*b/(2*pi);
cn=[c1 c0 c2];
n=-N:N;
plot(n,cn)