Undefined function 'F' for input arguments of type 'char'.
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(4 个)
per isakson
2014-8-30
编辑:per isakson
2014-8-30
Replace the string
Untitled
by
F
and replace
F := int((42 ....
by
F = int((42 ....
and see
0 个评论
M
2014-9-1
2 个评论
Geoff Hayes
2014-9-1
编辑:Geoff Hayes
2014-9-1
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
2014-9-1
"'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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!