필터 지우기
필터 지우기

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 CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by