How can I plot and reach to this figure ?
3 次查看(过去 30 天)
显示 更早的评论
I want to know the code that can I get same figure about Biorhythms ?
A) write a MATLAB code that can display Biorhythms for a person given their date of birth and the target date. Your Program should be able to plot the Biorhythms for a suitable spread around the target date (i.e., 30 days).
B) Annotation of the plot and curve with day and date.
C) Create a User‐Defined function to Calculate the total number of days between birthdate and target date. Create your own logic. Do not use any built‐in function (i.e., datenum) to calculate the total number of days
D) Demonstration of features that you have created/coded to add value to graph. · Demonstration that code works correctly using representative samples.
0 个评论
回答(2 个)
Star Strider
2020-8-5
编辑:Star Strider
2020-8-5
birthday = datenum(year, month, day);
t = 0:ceil(datenum(now)-birthday);
Physical = sin(2*pi*t/23);
The rest would be calculated similarly.
EDIT — (5 Aug 2020 at 22:34)
You did not previously state that this was an assignment. My initial impression was that you were simply interested in this.
5 个评论
Adam Danz
2020-8-5
I'm not going to do your work for you but I can give you some hints that will get you started. If you are unfamiliar with a function, look it up in the documentation.
1) Define a birthday. You can use datetime(). For example, this is today:
birthday = datetime(2020,08,05);
2) Define a second date which will be used to compute the number of days since the birthday (use datetime again). I'll call this variable endDate.
3) Compute the number of days between birthday and endDate using (fill in the 2 blanks)
daysSinceBirth = days(___ - ___)
4) Create the t variable from the equations you shared. t is a vector of values. Example:
t = linspace(0, daysSinceBirth, 50) where "50" is the number of data points between the min and max.
5) Use sin() to compute the equations you listed in your question. Example (fill in the blank):
y = sin(_____)
6) Create a vector of datetime values that will appear in your x-axis.
dt = birthday + days(t);
7) Use plot() to plot the results: plot(dt,y);
If you get stuck, show us what you tried and I'd be happy to give more hints.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!