Frustrating matlab is.

2 visualizaciones (últimos 30 días)
Benjamin Johnston
Benjamin Johnston el 29 de Sept. de 2020
Respondida: Steven Lord el 29 de Sept. de 2020
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 comentarios
VBBV
VBBV el 29 de Sept. de 2020
Editada: per isakson el 29 de Sept. de 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
Walter Roberson el 29 de Sept. de 2020
x = fivex2matrix(:,1);
y = fivex2matrix(:,2);

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 29 de Sept. de 2020
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.)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by