What's wrong with this script?

2 ビュー (過去 30 日間)
Shi Yuhao
Shi Yuhao 2014 年 4 月 27 日
コメント済み: Shi Yuhao 2014 年 4 月 27 日
t = linspace(0,2,100)
x = linspace(0,10,100)
U(t,x) = 10*sin(2*pi*(t-x/5))+2*sin(2*pi*(t+x/5))

採用された回答

Walter Roberson
Walter Roberson 2014 年 4 月 27 日
You cannot use 0 or fractions in your indices into U.
The syntax you are using is not a function definition: the syntax is an array access.
Use
U = 10 * sin(2 * pi * (t-x/5)) + 2 * sin(2 * pi * (t+x/5));
  1 件のコメント
Shi Yuhao
Shi Yuhao 2014 年 4 月 27 日
Thank you! I get it.

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

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 4 月 27 日
t = linspace(0,2,100)
x = linspace(0,10,100)
U= 10*sin(2*pi*(t-x/5))+2*sin(2*pi*(t+x/5))

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by