求问matlab 的 In an assignment A(I) = B,the number of elements in B and I must be the same.错在啊clear all;close allf(1)=1000;f(2)=400;f(3)=60;a(1)=0.005;a(2)=0.01;a(3)=0.02;f=2000;t=0:0.001:f-0.001;for i=1:3;x(i)=exp(-a(i)*2*pi*f(i)*t).*sin(2*

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/02 09:05:51
求问matlab 的 In an assignment A(I) = B,the number of elements in B and I must be the same.错在啊clear all;close allf(1)=1000;f(2)=400;f(3)=60;a(1)=0.005;a(2)=0.01;a(3)=0.02;f=2000;t=0:0.001:f-0.001;for i=1:3;x(i)=exp(-a(i)*2*pi*f(i)*t).*sin(2*

求问matlab 的 In an assignment A(I) = B,the number of elements in B and I must be the same.错在啊clear all;close allf(1)=1000;f(2)=400;f(3)=60;a(1)=0.005;a(2)=0.01;a(3)=0.02;f=2000;t=0:0.001:f-0.001;for i=1:3;x(i)=exp(-a(i)*2*pi*f(i)*t).*sin(2*
求问matlab 的 In an assignment A(I) = B,the number of elements in B and I must be the same.错在啊
clear all;
close all
f(1)=1000;
f(2)=400;
f(3)=60;
a(1)=0.005;
a(2)=0.01;
a(3)=0.02;
f=2000;
t=0:0.001:f-0.001;
for i=1:3;
x(i)=exp(-a(i)*2*pi*f(i)*t).*sin(2*pi*f(i)*t.*sqrt(1-a(i)))
end
for i=1:3
subplot(31i);plot(t,x(i));
end

求问matlab 的 In an assignment A(I) = B,the number of elements in B and I must be the same.错在啊clear all;close allf(1)=1000;f(2)=400;f(3)=60;a(1)=0.005;a(2)=0.01;a(3)=0.02;f=2000;t=0:0.001:f-0.001;for i=1:3;x(i)=exp(-a(i)*2*pi*f(i)*t).*sin(2*
帅锅,你搞得频率也太密集了吧,想考验我的计算机呀
我把你的变量减少了点,只要说明问题就行
这句x(i)=exp(-a(i)*2*pi*f(i)*t).*sin(2*pi*f(i)*t.*sqrt(1-a(i))) 有问题
首先,f是一个常数,不是一个数组,那来的f(i)呢?
第二,t是一个数组,你却想赋值给一个元素
第三,画图时,x(1)、x(2)、x(3)只代表一个元素,如何画图?
给你改了一下,可以运行了:
clear all;clc;
f(1)=1000;
f(2)=400;
f(3)=60;
a(1)=0.005;
a(2)=0.01;
a(3)=0.02;
f=20;
t=0:0.01:f-0.01;
for i=1:3
      x(i,:)=exp(-a(i)*2*pi*f*t).*sin(2*pi*f*t*sqrt(1-a(i)));
end   
for i=1:3   
    subplot(3,1,i);
    plot(t,x(i,:));
end