关于matlab plot画图的问题首先说明一下,这个程序能够通过运行,但是,画不出图像 clearclcD=[50 40 32];a=[0.7 0.665 0.63175];% after transforming from Hz to Hw,we got%real part is:-1/a+(1/a-a)*(1-a*cos(w*D)/(a^2+1-2*a*cos(w*D))
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 10:42:59
关于matlab plot画图的问题首先说明一下,这个程序能够通过运行,但是,画不出图像 clearclcD=[50 40 32];a=[0.7 0.665 0.63175];% after transforming from Hz to Hw,we got%real part is:-1/a+(1/a-a)*(1-a*cos(w*D)/(a^2+1-2*a*cos(w*D))
关于matlab plot画图的问题
首先说明一下,这个程序能够通过运行,但是,画不出图像
clear
clc
D=[50 40 32];
a=[0.7 0.665 0.63175];
% after transforming from Hz to Hw,we got
%real part is:-1/a+(1/a-a)*(1-a*cos(w*D)/(a^2+1-2*a*cos(w*D))
%imaginary part is:(1/a-a)*(-a*sin(w*D)/(a^2+1-2*a*cos(w*D)))
w=-2*pi:0.1:2*pi;
Hw=(atan(( -a(1)*sin(w*D(1))/(a(1)^2+1-2*a(1)*cos(w*D(1))))/(-1/a(1)+(1/a(1)-a(1))*(1-a(1)*cos(w*D(1))/(a(1)^2+1-2*a(1)*cos(w*D(1))))))+atan(( -a(2)*sin(w*D(2))/(a(2)^2+1-2*a(2)*cos(w*D(2))))/(-1/a(2)+(1/a(2)-a(2))*(1-a(2)*cos(w*D(2))/(a(2)^2+1-2*a(2)*cos(w*D(2))))))+atan(( -a(3)*sin(w*D(3))/(a(3)^2+1-2*a(3)*cos(w*D(3))))/(-1/a(3)+(1/a(3)-a(3))*(1-a(3)*cos(w*D(3))/(a(3)^2+1-2*a(3)*cos(w*D(3)))))));
plot(w,Hw)
但是用这个就可以
%Mini Project 5.80---question b
clear
clc
D=[50 40 32];
a=[0.7 0.665 0.63175];
% after transforming from Hz to Hw,we got
%real part is:-1/a+(1/a-a)*(1-a*cos(w*D)/(a^2+1-2*a*cos(w*D))
%imaginary part is:(1/a-a)*(-a*sin(w*D)/(a^2+1-2*a*cos(w*D)))
syms w;
Hw=(atan(( -a(1)*sin(w*D(1))/(a(1)^2+1-2*a(1)*cos(w*D(1))))/(-1/a(1)+(1/a(1)-a(1))*(1-a(1)*cos(w*D(1))/(a(1)^2+1-2*a(1)*cos(w*D(1))))))+atan(( -a(2)*sin(w*D(2))/(a(2)^2+1-2*a(2)*cos(w*D(2))))/(-1/a(2)+(1/a(2)-a(2))*(1-a(2)*cos(w*D(2))/(a(2)^2+1-2*a(2)*cos(w*D(2))))))+atan(( -a(3)*sin(w*D(3))/(a(3)^2+1-2*a(3)*cos(w*D(3))))/(-1/a(3)+(1/a(3)-a(3))*(1-a(3)*cos(w*D(3))/(a(3)^2+1-2*a(3)*cos(w*D(3)))))));
w=-2*pi:0.1:2*pi;
plot(w,subs(Hw))
谁能给我解释一下为什么,关于这个符号变量什么的我查了不明白,我觉得Hw不也是个数组么?最好详细点加个例子.讲的好可以再追加财富最高加100!,
关于matlab plot画图的问题首先说明一下,这个程序能够通过运行,但是,画不出图像 clearclcD=[50 40 32];a=[0.7 0.665 0.63175];% after transforming from Hz to Hw,we got%real part is:-1/a+(1/a-a)*(1-a*cos(w*D)/(a^2+1-2*a*cos(w*D))
上面的Hw算出来只有一个点啦,所以plot不行.不报错是因为,其实有画线,只不过y都取同一个值了.给你改了一下,你运行下,是不是你要的图.把下面这行代替你原来的那行求Hw
Hw=(atan(( -a(1)*sin(w*D(1))./(a(1)^2+1-2*a(1)*cos(w*D(1))))./(-1/a(1)+(1/a(1)-a(1))*(1-a(1)*cos(w*D(1))./(a(1)^2+1-2*a(1)*cos(w*D(1))))))+atan(( -a(2)*sin(w*D(2))./(a(2)^2+1-2*a(2)*cos(w*D(2))))./(-1/a(2)+(1/a(2)-a(2))*(1-a(2)*cos(w*D(2))./(a(2)^2+1-2*a(2)*cos(w*D(2))))))+atan(( -a(3)*sin(w*D(3))./(a(3)^2+1-2*a(3)*cos(w*D(3))))./(-1/a(3)+(1/a(3)-a(3))*(1-a(3)*cos(w*D(3))./(a(3)^2+1-2*a(3)*cos(w*D(3)))))));