Frustrating matlab is.
Afficher commentaires plus anciens
5x2matrix=[2 4;7 9;12 14;17 19;22 24]
x=[2;7;12;17;22]
y=[4;9;14;19;24]
% output equation: w=(10x^2)-13xy-(3y^2)
Problem: Using the values in the first column of the 5x2 matrix for x and the values in the second column of the 5x2 matrix for y. The output table should display x in the first column, y in the second column, and w in the third column.
I need help with how to assign the output equation to w using the 5x2matrix for the x and y values, and idk how to put all that info into one table. Thanks.
2 commentaires
VBBV
le 29 Sep 2020
Modifié(e) : per isakson
le 29 Sep 2020
x=[2;7;12;17;22]
y=[4;9;14;19;24]
% output equation: w=(10x^2)-13xy-(3y^2)
w=(10*x.^2)-13*x.*y-(3*y.^2);
T = [x y w];
Walter Roberson
le 29 Sep 2020
x = fivex2matrix(:,1);
y = fivex2matrix(:,2);
Réponses (1)
Steven Lord
le 29 Sep 2020
0 votes
Others have given you the answer. This problem involves just basic indexing in MATLAB, so I'm guessing you're relatively new to MATLAB (or haven't used MATLAB for a while.) If that is correct you may find the free MATLAB Onramp tutorial useful if you haven't already taken it. It teaches the basics of how to work with MATLAB. Some of the sections cover exactly the skills you needed to solve this problem (particularly sections 5 and 6.)
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!