MATLAB Write a well-commented function program for the function x^2e^-x^2, using
ID: 3143945 • Letter: M
Question
MATLAB
Write a well-commented function program for the function x^2e^-x^2, using entry-wise operations (such as . * and . degree) To get e^x use exp(x). Plot the function on [-5, 5] using enough points to make the graph smooth. Turn in printouts of the program and the graph. Write a well-commented script program that graphs the functions sin x, sin 2x, sin 3x, sin 4x, sin 5x and sin 6x on the interval [0, 2 pi] on one plot. (pi is pi in MATLAB) Use a sufficiently small step size to make all the graphs smooth. Turn in the program and the graph.Explanation / Answer
2.2
x=(0:(pi/6):(2*pi));
y1=sin(x);
y2=sin(2*x);
y3=sin(3*x);
y4=sin(4*x);
y5=sin(5*x);
y6=sin(6*x);
figure;
plot(x,y1,x,y2,x,y3,x,y4,x,y5,x,y6);
2.1
x=(-5:1:5);
y=(x.^2).*(exp(-x.^2));
figure;
plot(x,y);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.