error using contour z must be at least a 2x2 matrix
5 次查看(过去 30 天)
显示 更早的评论
x = (pi/2):0.1:(2*pi);
y = (pi/2):0.1:(2*pi);
z = sin(x) + cos(y);
contour3(x,y,z)
I need a contour plot of x,y,z variables. How do i get it?
0 个评论
采纳的回答
Birdman
2018-2-14
Use meshgrid.
x = (pi/2):0.1:(2*pi);
y = (pi/2):0.1:(2*pi);
[X,Y]=meshgrid(x,y);
z = sin(X) + cos(Y);
contour3(X,Y,z)
2 个评论
Connor Fitzgerald
2021-1-9
@Birdman, but why meshgrid?
My code with your implementation looks like:
plotX = app.UITablePlot.Data(:,2);
plotY = app.UITablePlot.Data(:,3);
plotZ = app.UITablePlot.Data(:,4);
[plotX2, plotY2] = meshgrid(plotX, plotY)
contour3(app.UIAxes, plotX2, plotY2, plotZ)
However I still receive the same error.
更多回答(1 个)
ZEESHAN AHMED
2023-1-18
How to plot contour map if I have individual data for example
- Torque (50001x1)
- speed (50001x1)
- efficiency(50001x13)
All of the data is taken from simulink in matrices.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!