Undefined function 'F' for input arguments of type 'char'.
Show older comments
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
Answers (4)
per isakson
on 30 Aug 2014
Edited: per isakson
on 30 Aug 2014
Replace the string
Untitled
by
F
and replace
F := int((42 ....
by
F = int((42 ....
and see
M
on 1 Sep 2014
2 Comments
per isakson
on 1 Sep 2014
"That didn't solve the problem."   There are several problems.
M
on 2 Sep 2014
M
on 1 Sep 2014
2 Comments
Geoff Hayes
on 1 Sep 2014
Edited: Geoff Hayes
on 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?
M
on 1 Sep 2014
per isakson
on 1 Sep 2014
0 votes
"'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
1 Comment
M
on 2 Sep 2014
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!