What's wrong with this script?

18 vues (au cours des 30 derniers jours)
Shi Yuhao
Shi Yuhao le 27 Avr 2014
Commenté : Shi Yuhao le 27 Avr 2014
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))

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Avr 2014
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 commentaire
Shi Yuhao
Shi Yuhao le 27 Avr 2014
Thank you! I get it.

Connectez-vous pour commenter.

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 27 Avr 2014
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))

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by