8. Your task is to create a script called thisPlot. This script should do the fo
ID: 642588 • Letter: 8
Question
8. Your task is to create a script called thisPlot.
This script should do the following:
% a. Ask the user to enter in a positive number, N,
greater than 5.
% b. Calculate the factorial for each number from 1 to N.
Each of these values should be stored into a vector.
% c. Display a graph titled 'Logarithmic Growth',
where the logarithms for each of the factorials are displayed.
% d. Add to the graph a continuous linear line that follows
The equation y = x with x values from 1 to N.
% e. Since the numbers will have different magnitudes,
Use plotyy to plot the linear values on the right hand axis.
use matlab to write the script
Explanation / Answer
N = 30
thisPlot(N)
end
function thisPlot(N)
x = 1:N;
vector=[]
for index=x
vector= [vector factorial(index)];
end
plotyy(x,log(vector),x, x )
title ('Logarithmic Growth')
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.