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!