I can't seem to plot this function with the given information. I'm not sure that my function is correct.

T = Tmean + (Tpeak - Tmean)cos(w(t - tpeak))

Tmean is the mean temp. over a year
Tpeak is the highest daily mean temp.
tpeak is the day that the peak temp. occurs
w has the value 2π/365

Write a function that takes Tpeak, tpeak and Tmean as inputs and outputs
the following return values:
1) The temp. for every day of the year as a 365-element vector
2) The minimum temp. for the year
3) The day with the minimum temp.

My function for this is:

``````function  [ev_day, yr_min, day_min]= av_temp(hd, myr, td)

% the inputs
% hd: highest daily mean temp
% td: the day that peak temp occur
% myr: mean temp over a year

%the outputs
% ev_day: temperature for everyday
% yr_min: minimum temperature for the year
% day_min: minimum temperature

t = 1:365
[ev_day, yr_min, day_min] = myr + (hd - myr)*cos(2*pi/365*(t - td));
[ev_day, yr_min, day_min] = min(myr,td)``````

Given that:
Tmean = 19.8
Tpeak = 25.9
tpeak = 13
How do I plot temp. for every day of the year?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by exo47r28

What language are you trying to do this in? (looks like Matlab to me)

Oh forgot to mention it is MATLAB

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.