给出函数g1 = 1 - d / r1和g2 = 1 - d / r2 这里d = 1,r1和r2定义为范围1到10,间距为0.1。 我试图绘制g1 vs g2,只有那些介于0< = g1 * g2< = 1之间的值。
代码是
clc
clear all
close all
d = 1;
r1 = 0:0.1:10;
r2 = 0:0.1:10;
g1 = 1-(d./r1);
g2 = 1- (d./r2);
s1 = size(g1);
s2 = size(g2);
for i = 1:101
e = g1(1,i);
for j = 1:101
if((e*g2(1,j)) <= 1 && (e*g2(1,j)>= 0))
plot(g1(1,j),g2(1,j),'o')
hold on
end
end
end