用MATLAB 画图

给出一系列的a值,采用函数x^2/a^2+y^2/(25-a^2) 画一组椭圆。

你的函数应该是等式,右边为1还是其他值?
用ezplot函数,如果等式右边为1的话,根据你题目的要求可以这样编:

% 原函数可化为:x^2/a^2+y^2/(25-a^2) - 1 = 0

a = ...; % 赋a的值
plotStr = strcat('x^2/',num2str(a),'^2+y^2/(25-',num2str(a),'^2)-1');
ezplot(plotStr);

试了一下,用以组循环来画能画出来比较好看的图形:)
for a = 0.1 : 0.5 : 5
plotStr = strcat('x^2/',num2str(a),'^2+y^2/(25-',num2str(a),'^2)-1');
ezplot(plotStr);
hold on;
end
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-09-20
syms x y;
for a=1:4
ezplot(x^2/a^2+y^2/(25-a^2))
figure
end
第2个回答  2020-10-25