Varying two variables in a for loop for one output
6 次查看(过去 30 天)
显示 更早的评论
These values are used later on to obtain 1 output that will be plotted in a 3d plot. I want to run a for loop where m(1) is compared to all the n values then the same will happen for m(2) and so on until I get all the possible points.
for index = 1:1:45
n = N_range(index);
m = m_water_range(index);
MW = m/nr;
MG = 1.6/Nr;
2 个评论
Cris LaPierre
2025-4-30
There are not enough details to provide a solution.
How are you comparing the values? Why are you comparing them? What is the value of nr and Nr? What is your output? Where should your for loop end?
采纳的回答
Cris LaPierre
2025-4-30
m_water_range = linspace(5,40,45);
N_range = linspace(5,50,45);
[m,n] = meshgrid(m_water_range,N_range);
MW = m./n;
MG = 1.6./n;
surf(m,n,MG)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
