Need help with a contour plot
2 views (last 30 days)
Show older comments
I need to be able to make a contour plot where I have the velocity value on the x axis and power at sea level on the y axis and two contour plots that use the values for Power Available and Power Required. The Velocity is a 1x 21 matrix, the Power avalible is a 21x 200 matrix, and the power required is a 21x 200 matrix. I'm pretty new at MATLAB and any help would be very appreiciated below is a picture of roughly what it should look like.
0 Comments
Answers (1)
Star Strider
on 11 Nov 2022
Edited: Star Strider
on 11 Nov 2022
It is difficult for me to understand what you want.
It is certainly poossible to get only one contour from each matrix and then plot them together (using the hold function) on one plot.
Getting the zero contour would go something like this —
[X,Y,Z] = peaks(50);
figure
surf(X,Y,Z)
colormap(turbo)
hold on
contour3(X,Y,Z,[0 0], '-r', 'LineWidth',3)
hold off
figure
[c,h] = contour(X,Y,Z,[0 0]);
% idx = find(c(1,:)==0 & rem(c(2,:),1)==0 & c(2,:)>0)
Unlike in this issultration, I get the impression that there should be only one contour in your data, so the ‘c’ output should contain the (x,y) coordinates of that line. If there are more than one contour, there are ways to deal with that, so it would help to have the necessary vectors and matrices in order to provide that result.
.
2 Comments
Star Strider
on 11 Nov 2022
The ‘Velocity’ is a (1x21) vector.
Creating it as a matrix is straightforward —
Velocity = 1:21
Vm = repmat(Velocity(:),1,200)
Try it with the ‘Vm’ matrix.
.
See Also
Categories
Find more on Contour Plots 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!