MATLAB怎么做两个figure?

我想做两个figure 一个是星形线,一个是四叶玫瑰线,这是我的代码
theta=linspace(0,2*pi,400);
rou=4*sin(2*theta);
figure(1)
hold on
polar(theta,rou);
b=2;
fh=@(x,y)x^(2/3)+y^(2/3)-b^(2/3)
ezplot(fh)
t=-2*pi:0.1:2*pi;
x=cos(t).^3;y=sin(t).^3;
figure(2);plot(x,y)
做出来以后四叶玫瑰线就跑到星形线的坐标轴里了 请大神帮忙看看哪里有错???

matlab使用figure(1), figure(2)...可以作出多幅图。示例如下:

1 theta=linspace(0,2*pi,400);

2 rou=4*sin(2*theta);

3 figure(1)

4 polar(theta,rou);

5 figure(2);

6 ezplot('x^(2/3)+y^(2/3)-2^(2/3)')


扩展资料

Matlab中的 figure 命令,能够创建一个用来显示图形输出的一个窗口对象。每一个这样的窗口都有一些属性,例如窗口的尺寸、位置,等等。

figure 的使用语法包括:

figure 

figure(‘PropertyName’,propertyvalue,…) 

figure(h) 

h = figure(…) 

第一种用法最简单,它创建一个窗口,其各种属性都是使用默认设置。 

第二种用法,figure(‘PropertyName’,propertyvalue,…),则可以指定某些属性。

温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-12-22
你干嘛要画3副图呢,figure(1)里有2个图,当然会重叠了
要不就画3副,要不就去掉一副:
clear all;clc;
theta=linspace(0,2*pi,400);
rou=4*sin(2*theta);
figure(1);
polar(theta,rou);hold on;
t=-2*pi:0.1:2*pi;
x=cos(t).^3;
y=sin(t).^3;
figure(2);
plot(x,y);
b=2;
fh=@(x,y)x^(2/3)+y^(2/3)-b^(2/3);
figure(3)
ezplot(fh);本回答被提问者采纳
第2个回答  2015-09-18

matlab使用figure(1), figure(2)...可以作出多幅图。示例如下:

theta=linspace(0,2*pi,400);
rou=4*sin(2*theta);
figure(1)
polar(theta,rou);
figure(2);
ezplot('x^(2/3)+y^(2/3)-2^(2/3)')

第3个回答  2012-12-22
一般是先开个figure()然后plot在figure里面
我不太懂fh是做什么的,就放figure(2)后面了。
clf;
close all;
clear all;
theta=linspace(0,2*pi,400);
rou=4*sin(2*theta);
figure(1)
polar(theta,rou);
b=2;
fh=@(x,y)x^(2/3)+y^(2/3)-b^(2/3);
t=-2*pi:0.1:2*pi;
x=cos(t).^3;
y=sin(t).^3;
figure(2);
ezplot(fh)
hold on;
plot(x,y)追问

还是不行,这次四叶玫瑰线好了,星形线变成那种情况了……

追答

你是不是要这种图,要加subplot的
theta=linspace(0,2*pi,400);
rou=4*sin(2*theta);
figure(1)
subplot(2,1,1)
polar(theta,rou);
b=2;
fh=@(x,y)x^(2/3)+y^(2/3)-b^(2/3)
subplot(2,1,2)
ezplot(fh)
t=-2*pi:0.1:2*pi;
x=cos(t).^3;y=sin(t).^3;
figure(2);plot(x,y)

相似回答