Problem 1: (25 Points) Save as lastname_prob1.m
Ask the user for inputs of the variables start, stop, inc and a. At runtime please enter values of 0, 30, 0.1 and 2, respectively. Plot the equation alt = sin(pi/4) + a•(t5)2, where a is 2 and t varies from 0 to 30 with a step size of 0.1 in a figure 2. Use an appropriate FOR loop to generate and store the values of t and alt. Add a title, xlabel and ylabel to the plot. Remember to clear at the beginning and pause at the end of the code.
Please can someone help me or explain things to me. I am lost and totally feeling bad with this lab work
que 1. For the same “alt” equation above, use a WHILE loop to solve for the time t (starting from 0) at which alt crosses 600 but this time use inc of 0.01 instead of 0.1. Use the command sprintf to create an output message displaying the time at which this occurs (label your answer clearly). Remember to clear at the beginning and pause at the end of the code.
que 2
Write the following userdefined matlab functions:
1. Create the function file lastname_loopspecs.m
This function asks the users for the desired loop specifications.
function [start, stop, inc, a]=lastname_loopspecs()
start=input('Please enter a value for Start: ');
stop=input('Please enter a value for Stop: ');
inc=input('Please enter a value for the Increment: ');
a=input('Please enter the value of a');
2. Create the function file lastname_calc_alt.m
This function calculates the altitude of an object given the equation:
alt = sin(pi/4) + a•(t5)2.
function alt=lastname_calc_alt(a,t)
Using these two predefined functions and a WHILE loop, find the time t at which alt crosses 600. Set inc to 0.01 and use the same “alt” equation above. Use the command sprintf to create an output message displaying the time at which this occurs (label your answer clearly). Remember to clear at the beginning and pause at the end of the code.
