Borrar filtros
Borrar filtros

Sinusoidal plot at constant value

1 visualización (últimos 30 días)
Bruno Rodriguez
Bruno Rodriguez el 27 de Feb. de 2017
Comentada: Bruno Rodriguez el 27 de Feb. de 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);

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by