How to create a matrix using two arrays (x & y) and a formula that uses x & y
27 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (1)
the cyclist
on 3 Oct 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 Comments
the cyclist
on 4 Oct 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)
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!