Question

Task 4 Download the temperatures.txt file from Moodle. The file contains temperature data which has beern collected once a datemperatures Notepad File Edit Format View Help 34.7114, 34.7512, 34.8033, 34.8360, 40.0000, 34.8742, 64.6931, 66.4996, 59.68Use the Matlab to solve this one, please!

Task 4 Download the temperatures.txt file from Moodle. The file contains temperature data which has beern collected once a day and contains noisy data. Write a MATLAB m-file that performs the following: Read the temperature values from temperatures.txt into a vector A. B. C. Plot the temperature against time using red diamond markers. Without using loops, remove the noisy data using the following rules: I Any temperature value above 45°C is invalid I Any temperature value below 0°C is invalid II The temperature values from day 5, 13 and 42 are invalid Do not set the invalid temperatures to O or NaN! Use logical statements instead. After removing the invalid temperature values, plot the valid temperature values against the corresponding valid times in a new figure as blue circles. D. Use either the fgetl) or the importdata() functions to import your data. You may need to use the str2num() command. HINT: If temperatures are stored in T, try valid_indices T> 45 HINT: What is the result of T(valid indices)?
temperatures Notepad File Edit Format View Help 34.7114, 34.7512, 34.8033, 34.8360, 40.0000, 34.8742, 64.6931, 66.4996, 59.6849, 64.1619, 34.9951, 34.9892, 5.0000, 35.0829, 34.9854, 34.9886, 34.9926, 34.97
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: I am unable to check whether the code is running or not.But, checked the syntax of every command used and tried to explain the steps/logic used in the program

Program:

%Import data from file

A=importdata("temperature.txt")

%convert string to number

T=str2num(A)

%to find the number of input data of temperature

k=size(T)

%creating a matrix with consequent number of days

day=1:k

%to find the indices of invalid temperatures

indices=find((T<0)&(T>45))

%removing corresponding elements in both T and day

T(indices)=[ ]

day(indices)=[ ]

%to find the indices with invalid day

wd=ismember(day,[5 13 42])

%removing corresponding elements

day(wd)=[ ]

T(wd)=[ ]

%plotting with day in x axis and temperature in y axis

plot(day,T,'d')

Add a comment
Know the answer?
Add Answer to:
Task 4 Download the temperatures.txt file from Moodle. The file contains temperature data which h...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Matlab question Task 2 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following...

    Matlab question Task 2 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following information: 1. Column 1: Student ID 2. Column 2--11: Lab marks (/10) worth 2% each (20% total of final grade) 3. Column 12: Assignment mark (/10) worth 10% of the final grade 4. Column 13: Exam mark (100) worth 70% of the final grade a) Write a function that accepts a student's laboratory, assignment and exam marks as inputs to determine the final mark...

  • Task 5 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following...

    use Matlab to solve this problem, thank you Task 5 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following information: 1. 2, 3, 4, Column 1: Student ID Column 2-11: Lab marks (/10) worth 2% each (20% total of final grade) Column 12: Assignment mark (/10) worth 10% of the final grade Column 13: Exam mark (/100) worth 70% of the final grade a) Write a function that accepts a student's laboratory, assignment and exam marks as...

  • Matlab question Task 2 It turns out that some values in lab4_plot_data.txt vary too much from...

    Matlab question Task 2 It turns out that some values in lab4_plot_data.txt vary too much from the sin(x) curve and should be removed as they are considered noisy (invalid). You are tasked with the following: a) Remove the noisy data using the following rules. Do not set the invalid data points to 0, 1) or NaNl Use logical statements in addition to true (1) and false (O) values to complete the task. a. An absolute difference of 0.4 or greater...

  • problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is...

    problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is resolved in crank angle degree and is taken every 1/2 degree. O tittps/ualearn blackboard.com/bbcswebdav/pid plot a new function on the same graph overwriting the orizinal function 1 of11ρ Functions to choose from: y A sin(Bx C)+ D y A sin2(Bx+ C) + D y A In(Bx + C)D y A exp(Bx + C)+ D ž. The file "Test Data.xlsx" contains in-cylinder pressure data from...

  • The table below contains data from an experiment to determine the growth rate of bacteria, k,...

    The table below contains data from an experiment to determine the growth rate of bacteria, k, as a function of oxygen concentration, c: c (mg/L) 0.5 0.8 1.5 2.5 4 k (per day) 1.1 2.4 5.3 7.6 8.9 A) Fit this data to a curve of the form:k =(Ac^2)/(B+c^2) Make sure to display and identify the values you get for A and B. Hint: transform the curve in c and k to a polynomial in (1/c2) and (1/k) B) Plot...

  • Problem 4. The following data are the temperatures (in degree Fahrenheit) of effluent at discharg...

    Problem 4. The following data are the temperatures (in degree Fahrenheit) of effluent at discharge from a sewage treatment facility on consecutive days: 43 47 51 48 52 50 4649 45 52 46 51 4444651 59 45 44 50 48 50 49 50 Using the Method of Moments, fit a normal distribution, a lognormal distribution, an exponential distribution, and a uniform distribution and provide the following for each distribution: a. Parameters of the distribution. Using the fitted distribution, find the...

  • 1) A spherical aluminum ball at a uniform temperature of 250°C is dropped into an oil...

    1) A spherical aluminum ball at a uniform temperature of 250°C is dropped into an oil t(s) Tscat t(C] bath at 50°C. The ball's surface temperature is measured using a thermocouple. The 250.3 table below (also provided as a spreadsheet in a separate file) shows the recorded 10 238.1 temperature versus time every ten seconds for 300 seconds. If the Bi #<<1, the lumped capacitance solution 20 230.1 30 221.0 6h e(t) = 0,exp( 219.0 40 PCD is valid. Here,...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

  • A spherical aluminum ball at a uniform temperature of 250°C is dropped into an oil |t...

    A spherical aluminum ball at a uniform temperature of 250°C is dropped into an oil |t [s] Tscat [C] bath at 50°C. The ball's surface temperature is measured using a thermocouple. The 250.3 table below (also provided as a spreadsheet in a separate file) shows the recorded 238.1 10 temperature versus time every ten seconds for 300 seconds. If the Bi #<<1, the 20 230.1 lumped capacitance solution 30 221.0 6h ө(С) — өоехр (- pCD 40 219.0 50 210.2...

  • I need help using python ( spyder) only use files , loops if needed is statement do not use , def...

    i need help using python ( spyder) only use files , loops if needed is statement do not use , def function or any other. Exercise 1: Daily temperature is recorded for some weeks in files (templ.txt", temp2.txt, and temp3.txt; provided in the MOODLE). The first line contains number of weeks and the rest of the lines each represent the week number followed by temperature on the seven days of that week (see samples input files below). Write a python...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT