Question
Matlab 1. Write a function that takes the square root of only positive values. If the value is negative assign a NaN value. Use an
Matlab 1. Write a function that takes the square root of only positive values. If the value is negative assign a NaN value. Use an if statement. Call your code sqrt_lastname.m 2. Create a code that loads Matrix.mat then uses your function sqrt_lastname from question 1 to solve for the square root of each of the values in the matrix. Display your answers. Call your code sqrt2_lastname.m 3. Write a code that allows you to guess a number and tells you that you have guessed the wrong number until you guess correctly. Display the number of guesses and your corresponding answer. Call your code guess_lastname.m (Hint: randi may be a useful function in order to generate the number to guess) 4. Create a code that loads MosquitoData. (hint: include file extension to load a .dat file)This matrix contains raw tide data from several different sites in Mosquito Lagoon, Stations 1-6 (Station 1=column 1, etc.). The sample rate is once every ten minutes. Create plots of the water level changes over the sample period for the first 4 stations; display these on a single figure using subplots. Make sure you title and label your graphs. Call your code tideplot_lastname.m 5. Calculate the area under the curve of the equation: = 1/4 Use the Reimann Sum method and rectangle widths of dx=[10, 1, 0.1, 0.01]. Do this over the interval 0 to 30. This can be done using a for-loop within a for-loop. Display the area outputs appropriately. Also plot the area being solved for. Make sure to title and label your graphs. Use "help area" if you need it and create all 4 plots in one sub plot. Call your code area_lastname.m
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started