Plotting time series of Velocity over 48 hours

조회 수: 5 (최근 30일)
John Carroll
John Carroll 2021년 10월 25일
댓글: John Carroll 2021년 10월 25일
I am trying to plot Velocity over a time frame of 48 hours. I have calculated Vm = 5.07. The given Velocity equation is: V(t) = Vm*sin((2*pi*t)/(Ttide));
My code is:
figure(1);
Vm=5.07; % Calculated on Paper
t=[1:1:48]; % Time over 48 hours
V(t) = Vm*sin((2*pi*t)/(Ttide)); % Velocity Equation
plot(t,V(t))
This is outputing a postivie sloping straight line, while I know the line should be sinusoidal.

채택된 답변

Scott MacKenzie
Scott MacKenzie 2021년 10월 25일
편집: Scott MacKenzie 2021년 10월 25일
% test value for Ttide (not given in question)
Ttide = 1;
figure(1);
Vm=5.07; % Calculated on Paper
%t=[1:1:48]; % Time over 48 hours
t = linspace(1,48); % use 100 sample points (or more)
V = Vm*sin((2*pi*t)/(Ttide)); % Velocity Equation (NOTE: change V(t) to just V)
plot(t,V)
  댓글 수: 2
John Carroll
John Carroll 2021년 10월 25일
Thank You!
Is it posible to have this be one line?
Ttide is give as Ttise=12.42 hours the converted to seconds as Ttide=12.42*60*60 (Forgot to mention)
John Carroll
John Carroll 2021년 10월 25일
Ive relized this is where my mistake was made!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by