フィルターのクリア

Sinusoidal plot at constant value

1 回表示 (過去 30 日間)
Bruno Rodriguez
Bruno Rodriguez 2017 年 2 月 27 日
コメント済み: Bruno Rodriguez 2017 年 2 月 27 日
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);

採用された回答

Walter Roberson
Walter Roberson 2017 年 2 月 27 日
contour(x, y, phi, [54500 54500])
Note my modification of the target value. Your phi values range from 53000 to 57000.
  1 件のコメント
Bruno Rodriguez
Bruno Rodriguez 2017 年 2 月 27 日
Thank you, works perfectly. And noted. I seem to have some scaling issue somewhere. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by