matlab 解方程,绘图,程序如下:S1=solve('sin(x)-a*cos(x)=0.8','x');a=0.1:0.1:1;s01=eval(s1);y=tan(s01);plot(a,y)程序功能可以实现,就是出现一个warning,提示错误使用 plot 因为y里面有 ‘复数’,怎么解决这个问题,

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 14:05:15
matlab 解方程,绘图,程序如下:S1=solve('sin(x)-a*cos(x)=0.8','x');a=0.1:0.1:1;s01=eval(s1);y=tan(s01);plot(a,y)程序功能可以实现,就是出现一个warning,提示错误使用 plot 因为y里面有 ‘复数’,怎么解决这个问题,

matlab 解方程,绘图,程序如下:S1=solve('sin(x)-a*cos(x)=0.8','x');a=0.1:0.1:1;s01=eval(s1);y=tan(s01);plot(a,y)程序功能可以实现,就是出现一个warning,提示错误使用 plot 因为y里面有 ‘复数’,怎么解决这个问题,
matlab 解方程,绘图,
程序如下:S1=solve('sin(x)-a*cos(x)=0.8','x');
a=0.1:0.1:1;
s01=eval(s1);
y=tan(s01);
plot(a,y)
程序功能可以实现,就是出现一个warning,提示错误使用 plot 因为y里面有 ‘复数’,怎么解决这个问题,
新手没多少分,多多包涵!
我用的是matlab 2010b 版本,用plot画图,waring显示 复数的虚数部分忽略,我只是想屏蔽复数值,但无法实现裁剪,用eval=sym(‘eval’,‘real’),也无法实现,就是只想要实数的x值,然后画出来,赐教。

matlab 解方程,绘图,程序如下:S1=solve('sin(x)-a*cos(x)=0.8','x');a=0.1:0.1:1;s01=eval(s1);y=tan(s01);plot(a,y)程序功能可以实现,就是出现一个warning,提示错误使用 plot 因为y里面有 ‘复数’,怎么解决这个问题,
By checking your s01:
>> s01
s01 =
Columns 1 through 5
1.0204 1.0992 1.1645 1.2177 + 0.0000i 1.2610 + 0.0000i
2.3206 2.4372 2.5600 + 0.0000i 2.6849 2.8078
Columns 6 through 10
1.2964 + 0.0000i 1.3254 + 0.0000i 1.3495 1.3696 + 0.0000i 1.3867
2.9260 3.0376 + 0.0000i -3.1416 - 0.0000i -3.0456 + 0.0000i -2.9575
You will notice that all image parts are zeros. So you can simply get rid of them:
>> s01 = real(s01)
s01 =
1.0204 1.0992 1.1645 1.2177 1.2610 1.2964 1.3254 1.3495 1.3696 1.3867
2.3206 2.4372 2.5600 2.6849 2.8078 2.9260 3.0376 -3.1416 -3.0456 -2.9575

我运行了一下,没错,注意一点matlab分大小写

对于复函数画图显示,我们一般都是将其实部或者虚部分别显示的,要么就显示其幅值等等。