How to create matrix and solve for answers?

2 ビュー (過去 30 日間)
Danny Maefengea
Danny Maefengea 2020 年 8 月 28 日
編集済み: Alan Stevens 2020 年 8 月 28 日
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?

採用された回答

Alan Stevens
Alan Stevens 2020 年 8 月 28 日
% 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 件のコメント
Alan Stevens
Alan Stevens 2020 年 8 月 28 日
編集済み: Alan Stevens 2020 年 8 月 28 日
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.
Danny Maefengea
Danny Maefengea 2020 年 8 月 28 日
Thank you once again Sir. Best wishes and stay safe.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by