Need help with a contour plot

2 vues (au cours des 30 derniers jours)
Kaden Bauernfeind
Kaden Bauernfeind le 11 Nov 2022
Commenté : Star Strider le 11 Nov 2022
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.

Réponses (1)

Star Strider
Star Strider le 11 Nov 2022
Modifié(e) : Star Strider le 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 commentaires
Kaden Bauernfeind
Kaden Bauernfeind le 11 Nov 2022
Modifié(e) : Kaden Bauernfeind le 11 Nov 2022
Yeah its two seperate contours but Im having an issue that the X and Z dont match in size.
Star Strider
Star Strider le 11 Nov 2022
The ‘Velocity’ is a (1x21) vector.
Creating it as a matrix is straightforward —
Velocity = 1:21
Velocity = 1×21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Vm = repmat(Velocity(:),1,200)
Vm = 21×200
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Try it with the ‘Vm’ matrix.
.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by