I have a code but it keep saying "invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.

1 回表示 (過去 30 日間)
Evan Skaer
Evan Skaer 2021 年 10 月 20 日
回答済み: Rik 2021 年 10 月 20 日
x1=linspace(0,8.*pi,50)
y1=exp(-0.1.*x1).*cos(5.*x1)
xx1=(0,8.*pi,1000)
x2=linspace(-1,1)
yy1=exp(-0.1.*x2).*cos(5.*x2)
y2=sinh(5.*x3)
x3=(-4,4)
y3=0.5+2.*cos(0.5.*pi.*x3)/pi-2.*cos(1.5.*pi.*x3)/(3.*pi)+2.*cos(2.5.*pi.*x3)/(5.*pi)
x4=linspace(-4,4)
y4=y3-2.*cos(3.5.*pi.*x4)/(7.*pi)+2.*cos(4.5.*pi.*x4)/(9.*pi)
plot(x1,y1)
plot(xx1,yy1)
plot(x2,y2)
plot(x3,y3)
plot(x4,y4)

回答 (1 件)

Rik
Rik 2021 年 10 月 20 日
The reason is these two lines:
xx1=(0,8.*pi,1000)
x3=(-4,4)
Did you maybe forget linspace?
Anyway, this isn't valid Matlab syntax. If you thought it was, I encourage you to do a basic Matlab tutorial.

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by