Effacer les filtres
Effacer les filtres

Sinusoidal plot at constant value

1 vue (au cours des 30 derniers jours)
Bruno Rodriguez
Bruno Rodriguez le 27 Fév 2017
Commenté : Bruno Rodriguez le 27 Fév 2017
Hi all,
I am trying to plot a sinusoidal line across all points where the function "phi" equals 5450, but I am unsure how to go about this. My first thought was to calculate phi for all values of x and y using a for loop, and then use the find function to determine the index of those points where phi=5450. Is there a way to make matlab plot the points at which the function is equal to a set value?
phi0=5.5*10^4;
U=20; %m/s
y=(-1000*10^3):1000:(1000*10^3);
x=(-2000*10^3):1000:(2000*10^3);
Lx=4*10^6;
Ly=4*10^6;
k=(2*pi)./Lx;
l=(2*pi)./Ly;
A=8*10^6;
f=10^-4;
for i = 1:length(y)
for j = 1:length(x)
phi(i,j) = phi0 - (f*U*y(i)) + (f*A*sin(k*x(j))*cos(l*y(i)));
end
end
id5450 = find(phi==5450);

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Fév 2017
contour(x, y, phi, [54500 54500])
Note my modification of the target value. Your phi values range from 53000 to 57000.
  1 commentaire
Bruno Rodriguez
Bruno Rodriguez le 27 Fév 2017
Thank you, works perfectly. And noted. I seem to have some scaling issue somewhere. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by