How can I plot and reach to this figure ?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/342007/image.png)
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 commentaires
Réponses (2)
Star Strider
le 5 Août 2020
Modifié(e) : Star Strider
le 5 Août 2020
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 commentaires
Adam Danz
le 5 Août 2020
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.
Voir également
Catégories
En savoir plus sur Birthdays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!