Help me to do difficult tasks in MATLAB
5 views (last 30 days)
Show older comments
Good day, friends! :)
I have no idea how to work in MATLAB, but I need to do some tasks. I have file named "airtempt.mat". When I open it in MATLAB I see in workspace 3 data elements (air 1 (value 1460x1 doubled) , air 2 (value 1460x1 doubled) and t (value 1460x1 doubled)), Then I shoud to do 2 tasks. But i cannot do it, becouse it's my first time in MATLAB and i want to know how can I do it and very need your assistance please (if it possible write MATLAB code to illustrate me how it is working) :)
Here it is:
"
- Assignment: Statistic Tests
Introduction:
Below each question, please insert MATLAB codes (functions, commands) that you use to solve that question and copy the MATLAB outcomes. Please insert the required figures below the questions, and the figures should be clear and informative.
Load the data file “airtemp.mat” into MATLAB. You can either double click the file, or use command “load airtemp.mat”. Then you will see 3 variables in MATLAB:
air1: Air temperatures every 6 hours for entire year of 2013, at Station SEATS in the South China Sea (18°N, 118°E);
air2: Air temperatures every 6 hours for entire year of 2013, at a location in Sahara Desert (18°N, 20°E);
t: time of each data point in number of days in the year.
Question 1. (C5, CLO3, PLO6)
Consider how to code a MATLAB function to calculate moving average of a variable x:
y = mvavg(x, n),
in which n is the number of data points used for calculating each average. Then, evaluate the daily moving average of air1 and air2 using your coded function.
If you don’t know “moving average”, please check its definition on Internet. You must note that “daily moving average” is differentfrom “daily average”!
Plot on one figure including air1, air2 and their daily moving averages over time. (hint: you can also calculate daily moving average for t, so that the number of elements in the moving average of air1, air2 and t is same.)
Question 2. (C5, CLO3, PLO6)
Plot temperature of the two stations over time on one figure, using markers, no connecting lines. Requirements:
- if the average temperature of one day (“today”) is higher than the day before by more than 1 degree (i.e. T_today – T_yesterday > 1), then ALL the 4 data points of “today” use red color;
- if the average temperature of one day (“today”) is lower than the day before by more than 1 degree (i.e. T_yesterday – T_today > 1), then ALL the 4 data points of “today” use blue color;
- if the difference between T_today and T_yesterday is no more than 1 degree, all the 4 data points of “today” use black color (you can also use black color for the markers of the first day).
- Assess the differences in the temperature patterns between the two sites. Please explain possible reasons for the differences."
1 Comment
Dyuman Joshi
on 7 Nov 2023
"I have no idea how to work in MATLAB, but I need to do some tasks."
"But i cannot do it, becouse it's my first time in MATLAB and i want to know how can I do it"
I strongly recommend you to take the free introductory course - MATLAB Onramp to learn the essentials of MATLAB.
After you go through the course, you should be able to write a code. Then, if you are having a probelm, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty.
And the assignment also has hints included in it, so that would be helpful as well.
Answers (2)
Suzur
on 7 Nov 2023
Edited: Suzur
on 7 Nov 2023
1 Comment
Dyuman Joshi
on 7 Nov 2023
"CHAT GPT write me this, but it doesn't work:"
ChatGPT is not a reliable (programming) resource.
Image Analyst
on 7 Nov 2023
To learn other fundamental concepts, invest 2 hours of your time here:
To get a moving average you can use movmean
0 Comments
See Also
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!