creating 3d surface plots by iterating in for loop through different vectors
7 次查看(过去 30 天)
显示 更早的评论
I am working on creating a 3d plot. I have these variables as matrices but I need to generate a 3d matrix with for loop iteratively and plot as seen in the below code.
In this code the plot is like a seperate vector output because it won't generate a surface, but scattered points. I would like an 3d surface plot by generating a 3d matrix with for loop iteratively. Please help me out on this!
x = Oil_Flow_Rate; % create a matrix of complex inputs
y = Oil_Temp;
z = Water_Temp;
w = TMax; % calculate the complex outputs
scatter3(x,y,z,40,w,'filled') % visualize the complex function using surf
ax = gca;
ax.XDir = 'reverse';
view(-31,14)
xlabel('Oil FlowRate [L/min]','FontWeight','Bold','FontSize',sizeW)
ylabel('Oil Temp [°C]','FontWeight','Bold','FontSize',sizeW)
zlabel('Water Temp [°C]','FontWeight','Bold','FontSize',sizeW)
cb = colorbar; % create and label the colorbar
cb.Label.String = 'TMax [°C]';
0 个评论
回答(1 个)
Walter Roberson
2023-5-10
In a situation like that, I would not recommend creating the entries iteratively in a loop. Instead I would suggest creating a grid of locations you want the values to be evaluated at, and use either griddata or scatteredInterpolant
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!