Undefined function 'F' for input arguments of type 'char'.
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (4)
per isakson
el 30 de Ag. de 2014
Editada: per isakson
el 30 de Ag. de 2014
Replace the string
Untitled
by
F
and replace
F := int((42 ....
by
F = int((42 ....
and see
0 comentarios
M
el 1 de Sept. de 2014
2 comentarios
per isakson
el 1 de Sept. de 2014
"That didn't solve the problem."   There are several problems.
M
el 1 de Sept. de 2014
2 comentarios
Geoff Hayes
el 1 de Sept. de 2014
Editada: Geoff Hayes
el 1 de Sept. de 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
el 1 de Sept. de 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
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!