How to plot a function with e^-x?

9 visualizaciones (últimos 30 días)
Anelisse Meriles
Anelisse Meriles el 5 de Abr. de 2020
Comentada: Anelisse Meriles el 5 de Abr. de 2020
Hello, I'm trying to plot functions f(x)=100*x^2 and f(x) = 100*x^2*e^-x with time vectors from 0 to 5. I keep getting errors on my function.What is the right way to insert this function in Matlab?
This is my logic:
x = 0 : 0.1 : 5;
y = (100)*(x.^2);
hold on
g = 100*(x.^2)*exp(-x);
plot(x,y,'r',x,g,'b')
grid on

Respuesta aceptada

David Hill
David Hill el 5 de Abr. de 2020
g = 100*(x.^2).*exp(-x); %looks good, just need .* The rest should work

Más respuestas (0)

Categorías

Más información sobre Graphics Objects en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by