How to create a matrix using two arrays (x & y) and a formula that uses x & y
29 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Thomas Pruchinski
el 3 de Oct. de 2021
Comentada: the cyclist
el 4 de Oct. de 2021
So if
x = [4.0:-.05:3.7]
&
y = [9;15;21;27;33;39;45]
&
z = 1.3473*152/(152+y)+(5-x)*y/(152+y)
How do I create a matrix that calculates output z at the different possible combinations of x & y?
0 comentarios
Respuesta aceptada
Más respuestas (1)
the cyclist
el 3 de Oct. de 2021
Use the meshgrid function to create 2-dimensional grids from the x and y vectors. The first example in the documentation is very similar to what you want to do.
3 comentarios
the cyclist
el 4 de Oct. de 2021
x = [4.0:-.05:3.7] ;
y = [9;15;21;27;33;39;45];
[xx,yy] = meshgrid(x,y);
z = 1.3473*152./(152+yy)+(5-xx).*yy./(152+yy)
Ver también
Categorías
Más información sobre Linear Least Squares en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!