I would like to plot row 1 and row 3 of B as (x vs y plot graph).

2 ビュー (過去 30 日間)
SAM MATHWORKS
SAM MATHWORKS 2022 年 9 月 25 日
コメント済み: SAM MATHWORKS 2022 年 9 月 26 日
I would like to plot row 1 and row 3 of B as (y vs x plot graph). However, I could only plot using the last iteration which is 10. What can i do to get all the iteration so i can plot y against x plot?
syms x y z
for i=1:10
eqn1 = 2.*x + 2.*i.*y + z == 2;
eqn2 = -x + y - i.*z == 3;
eqn3 = x + 2.*y + 3.*z == 10.*i;
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3], [x, y, z])
end
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
A = 
B = 
figure(1)
plot(B(1,:),B(3,:))

回答 (1 件)

Davide Masiello
Davide Masiello 2022 年 9 月 25 日
編集済み: Davide Masiello 2022 年 9 月 25 日
I suspect you want something like this
syms x y z
for i=1:10
eqn1 = 2.*x + 2.*i.*y + z == 2;
eqn2 = -x + y - i.*z == 3;
eqn3 = x + 2.*y + 3.*z == 10.*i;
[A(:,:,i),B(:,1,i)] = equationsToMatrix([eqn1, eqn2, eqn3], [x, y, z]);
end
figure(1)
plot(B(:,1,1),B(:,1,3),'-o')
  1 件のコメント
SAM MATHWORKS
SAM MATHWORKS 2022 年 9 月 26 日
Dear Mr. Masiello, it was not what I wanted, however your code had given me an idea to find the plot that I was looking for.
syms x y z
for i=1:10
eqn1 = 2.*x + 2.*i.*y + z == 2;
eqn2 = -x + y - i.*z == 3;
eqn3 = x + 2.*y + 3.*z == 10.*i;
[A(:,:,i),B(:,1,i)] = equationsToMatrix([eqn1, eqn2, eqn3], [x, y, z]);
end
figure(1)
plot(B(1,:),B(3,:),'-o')

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by