What's wrong with this script?

2 次查看(过去 30 天)
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 个)

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 CenterFile Exchange 中查找有关 Data Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by