Frustrating matlab is.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
VBBV
2020-9-29
编辑:per isakson
2020-9-29
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];
回答(1 个)
Steven Lord
2020-9-29
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.)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!