Write a Scilab script that takes no inputs and displays the following informatio
ID: 3108484 • Letter: W
Question
Write a Scilab script that takes no inputs and displays the following information.
Use the colon operator or the linspace() function to create a row vector named ‘X’ that goes from 0 to 20 in increments of 0.5. Use the disp() function to display the vector ‘X’.
Using the mathematical equation Y= -0.45X2+9.5X, to calculate the result of ‘Y’ for each of the ‘X’ values. Use the disp() function to display the vector ‘Y’.
Hint, use the following sciLab equation
Y=-0.45*X.^2+9.5*X
Use the max() function to find the peek point of ‘Y’ and the location of the peek point. Use this information to find the corresponding ‘X’ value. Use the disp() function to display the peek and the corresponding ‘X’ value.
Explanation / Answer
clc;
clear all;
X = linspace(0,0.5,20);
Y=-0.45*X.^2+9.5*X;
disp(Y')
peek_point=max(Y);
disp(peek_point)
0
0.2497
0.4988
0.7472
0.9950
1.2422
1.4888
1.7347
1.9801
2.2248
2.4688
2.7123
2.9551
3.1973
3.4389
3.6799
3.9202
4.1599
4.3990
4.6375
4.6375
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.