How to create a matrix using two arrays (x & y) and a formula that uses x & y
29 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(1 个)
the cyclist
2021-10-3
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 个评论
the cyclist
2021-10-4
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!