plot solution of linear systems (linsolve)
์กฐํ ์: 5 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
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
๋ต๋ณ (2๊ฐ)
madhan ravi
2018๋
12์ 15์ผ
ํธ์ง: madhan ravi
2018๋
12์ 15์ผ
doc syms
doc fplot
doc equationsToMatrix
doc linsolve
doc plot % see how to plot a single point especially markers
doc legend
doc xlim
๋๊ธ ์: 0
Star Strider
2018๋
12์ 15์ผ
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.
๋๊ธ ์: 0
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Mathematics์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
