Filter löschen
Filter löschen

Sinusoidal plot at constant value

1 Ansicht (letzte 30 Tage)
Bruno Rodriguez
Bruno Rodriguez am 27 Feb. 2017
Kommentiert: Bruno Rodriguez am 27 Feb. 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);

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by