Undefined function 'F' for input arguments of type 'char'.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to create a function F(t) that is equal to a convolution integral, and then compute theta_n(n+1) by taking the value F(tn). However, I'm getting the error "Undefined function 'F' for input arguments of type 'char'". What's the problem?
function [ theta ] = Untitled( theta_o,omega_o )
nt=5001; %since (50-0)/.01 = 5000
dt = .01; % =H
H=.01;
theta_n = ones(nt,1);
theta_n(1)=0; %theta_o
omega_n = ones(nt,1);
omega_n(1)=-0.4; %omega_o
epsilon=10^(-6);
eta = epsilon*10;
t_o=0;
for n=1:4999
tn=t_o+n*dt;
F := int((422.11/eta)*exp((5*(4*((eta*t-s-tn)^2)/eta^2)-1)^(-1))*omega, s,tn-(n/2),tn+(n/2))
theta_n(n+1) = theta_n(n) + h*F(tn);
end
end
0 commentaires
Réponses (4)
per isakson
le 30 Août 2014
Modifié(e) : per isakson
le 30 Août 2014
Replace the string
Untitled
by
F
and replace
F := int((42 ....
by
F = int((42 ....
and see
0 commentaires
M
le 1 Sep 2014
2 commentaires
Geoff Hayes
le 1 Sep 2014
Modifié(e) : Geoff Hayes
le 1 Sep 2014
M - please stop using the Answer this question box to further the dialog/conversation, since what you are posting does not solve the original question and will just prove confusing for other readers.
You have changed your code considerably in that you have introduced two local functions F and Keta. Why? What is the purpose of each that you feel you need them now?
And you have assigned the output of a statement to F which is the name of your local function.
Look as well at the body of F - what is
sys s
?
The error message, Undefined function or variable 's', should be clear. You are trying to use s before it has been defined. Where in your code are you doing that?
per isakson
le 1 Sep 2014
"'s' is just a dummy variable, so why do I need to define it?"  
If you try to define a function, F, see Anonymous Functions and Function Basics, Create functions, including anonymous, local, and nested functions
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!