MATLAB: Inline to Anonymous Function

anonymous functionsinline()MATLABplots

How can I use anonymous functions to make this plot?
clear all;clc;
x =inline('5*sin(2*pi*1*t).*exp(-.4*t)','t');
t = (-10:.01:10);
plot(t,x(t));
xlabel ('t (seconds)');
ylabel ('Ámplitude');

Best Answer

Simply replace your x = inline... etc expression with
x = @(t) 5*sin(2*pi*1*t).*exp(-.4*t);