Hello.
I am looking for a code that will help me plot a graph of solution of these two linear systems. My codes are the following, however, how can I get a solution into one plot with lines representing solution for each equation?
? +? +? = 2
? +2? โˆ’? = 4
โˆ’? +2? +? = 2
% LS for A
A = [1 1 1; 1 2 -1; -1 2 1];
a = [2; 4; 2];
linsolve(A,a)
plot ????

๋Œ“๊ธ€ ์ˆ˜: 6

Matt J
Matt J 2018๋…„ 12์›” 14์ผ
The result of your example code is 3 values.
>> linsolve(A,a)
ans =
0.7500
1.5000
-0.2500
Please elaborate how these 3 values would form a plot
M03
M03 2018๋…„ 12์›” 14์ผ
Right? I was also wondering. But I need a plot, which contains three lines (one for every equation) describing the relationship of linear system. It should look like the one on the pictureplot.jpg
M03
M03 2018๋…„ 12์›” 14์ผ
I am actually looking for ther intersection if they have a solution
Matt J
Matt J 2018๋…„ 12์›” 14์ผ
ํŽธ์ง‘: Matt J 2018๋…„ 12์›” 14์ผ
But your original example is 3x3 system (with 3 unknowns), while your figure illustration is a 3x2 system (2 unknowns).
M03
M03 2018๋…„ 12์›” 14์ผ
That's the point. I should make one for the system above.
And if I have a 3x2 system like this, how will the code look like?
+2? +? =
7 ? โˆ’2? = 1
โˆ’? +5? = 4
Matt J
Matt J 2018๋…„ 12์›” 16์ผ
An equation in 3 unknowns does not define a line, but rather a plane.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

๋‹ต๋ณ€ (2๊ฐœ)

madhan ravi
madhan ravi 2018๋…„ 12์›” 15์ผ
ํŽธ์ง‘: madhan ravi 2018๋…„ 12์›” 15์ผ

0 ๊ฐœ ์ถ”์ฒœ

doc syms
doc fplot
doc equationsToMatrix
doc linsolve
doc plot % see how to plot a single point especially markers
doc legend
doc xlim
Star Strider
Star Strider 2018๋…„ 12์›” 15์ผ

0 ๊ฐœ ์ถ”์ฒœ

This was something of a challenge in the format presented.
% % % Equations: -2*x + y = 1; 3*x + 2*y = 10; -15*x + 2*y = -80
X = [-5 1; 10 1]; % Create: [X 1] Matrix
A = [2 1; -3/2 10/2; 15/2 -80/2]; % โ€˜Solveโ€™ The Equations In โ€˜y = B1*x + B2โ€™ Form
Y = X * A'; % Solve For โ€˜Yโ€™
CoefVct = linsolve([A(:,1), ones(size(A(:,1)))], A(:,2));
figure
plot(X(:,1), Y)
Ax = gca;
Ax.YAxisLocation = 'origin';
ylim([0 20])
producing:
CoefVct =
-5.21862348178138
2.58299595141701
and the plot.
The plot appears to be as requested.

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Mathematics์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์งˆ๋ฌธ:

M03
2018๋…„ 12์›” 14์ผ

๋Œ“๊ธ€:

2018๋…„ 12์›” 16์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by