In: Computer Science
MATLAB Question
Write a script to plot the function 'x times sine-squared of x' over a user-specified interval. It should prompt the user to enter the starting and stopping values of x, perform the calculation, and plot the result. Test the script using start/stop values 28 and 42.
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
clc
clear all
close all
format long;
x1=input('Enter starting value of x: ');
x2=input('Enter stopping value of x: ');
x=linspace(x1,x2);
y=x.*(sin(x).^2);
plot(x,y);
xlabel('X-values');
ylabel('Y-values');
title('Plot of x*(sin(x)^2)');
Kindly revert for any queries
Thanks.