How to create matrix and solve for answers?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Danny Maefengea
il 28 Ago 2020
Modificato: Alan Stevens
il 28 Ago 2020
Hi friends, I was trying to solve the problem below using matrix (system of linear equations) but I couldn't get to the final answers. I have also attached a MATLAB file showing how far I got in trying to solve the problem.
Can any body please help? Thank you so much for your help.
Problem:
Using MATLAB, represent the following using matrix form and solve it.
A local theatre sold out for their show. They sold all 500 tickets for 8, 070.00. The tickets were priced at 15 for students, 12 for children, and 18 for adults. If the band sold three times as many adult tickets as children’s tickets, how many of each type was sold?
0 Commenti
Risposta accettata
Alan Stevens
il 28 Ago 2020
% Your equations are:
% A + S + C = 500;
% 18*A + 15*S + 12*C = 8070;
% A = 3*C;
% where A = nbr of adults, B = nbr students, C = nbr children
%
% Set these in the form
% M*ASC = V where
% M = [1 1 1
% 18 15 12
% 1 0 -3 ]
% V = [500
% 8070
% 0 ]
% and
% ASC = [A
% B
% C]
%
% Using Matlab's backslash operator you can then solve for ASC
%
% ASC = M\V
%
% Then extract values for A, S and C
% A = ASC(1); B = ASC(2); C = ASC(3);
3 Commenti
Alan Stevens
il 28 Ago 2020
Modificato: Alan Stevens
il 28 Ago 2020
The script above consists of comment lines!
For M write
M = [1 1 1; 18 15 12; 1 0 -];
for V
V = [500; 8070; 0];
Remove the comment symbol (%) from the ASC = M\V line
ASC = M\V;
Remove the comment symbol from the last line.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!