Inline to Anonymous Function

7 ビュー (過去 30 日間)
Russell Buttriss
Russell Buttriss 2020 年 9 月 3 日
コメント済み: Russell Buttriss 2020 年 9 月 3 日
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');

採用された回答

Alan Stevens
Alan Stevens 2020 年 9 月 3 日
Simply replace your x = inline... etc expression with
x = @(t) 5*sin(2*pi*1*t).*exp(-.4*t);
  1 件のコメント
Russell Buttriss
Russell Buttriss 2020 年 9 月 3 日
Thank you!

サインインしてコメントする。

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2020 年 9 月 3 日
x =@(t) 5*sin(2*pi*1*t).*exp(-.4*t)'
  1 件のコメント
Russell Buttriss
Russell Buttriss 2020 年 9 月 3 日
Thank you!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by