Plot the following function over a given interval:

I am new to MATLAB and having difficulty generating a plot over the interval x = [0,7] for following equation:
This is what I have so far:
fplot(exp(0.5*x)*(2*sin(5*x)-0.6*cos(0.7*x)),[0,7])
axis([0,7,-1,1])
Could someone please explain what is wrong with my syntax/formatting? Thank you.

回答 (1 件)

Star Strider
Star Strider 2016 年 10 月 9 日

0 投票

If you haven’t, you have to declare x as a symbolic object.
This works (in R2016b):
syms x
fplot(exp(0.5*x)*(2*sin(5*x)-0.6*cos(0.7*x)),[0,7])

1 件のコメント

auto2060
auto2060 2016 年 11 月 18 日
編集済み: auto2060 2016 年 11 月 18 日
Also this:
fplot(@(x)exp(0.5*x).*(2*sin(5*x)-0.6*cos(0.7*x)),[0,7]) % note the .* after exp(0.5*x)

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

カテゴリ

質問済み:

2016 年 10 月 9 日

編集済み:

2016 年 11 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by