Defining variables inside of a function
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Khalid Sherif
il 7 Ott 2018
Commentato: madhan ravi
il 7 Ott 2018
t = 0:0.1:2; y(t) = cos(2*t); Array indices must be positive integers or logical values.
My problem here is that I want to have the variable "t" known inside the parentheses beside "y" as a regular written function in Matlab but I can't figure it out I tried searching for it online and found nothing.
0 Commenti
Risposta accettata
madhan ravi
il 7 Ott 2018
Modificato: madhan ravi
il 7 Ott 2018
syms y(t)
y(t) = cos(2*t)
t = 0:0.1:2;
y=double(subs(y))
OR
y =@(t) cos(2*t) %Not sure which one you want but both gives the same results
y(t)
4 Commenti
Più risposte (1)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!