How to create matrix and solve for answers?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
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
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!