creating 3d surface plots by iterating in for loop through different vectors
16 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 10 May 2023
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
See Also
Categories
Find more on Annotations 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!