Inline to Anonymous Function

3 views (last 30 days)
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');

Accepted Answer

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

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 3 Sep 2020
x =@(t) 5*sin(2*pi*1*t).*exp(-.4*t)'

Categories

Find more on Function Creation in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!