syntax error with using the ode45 function
이전 댓글 표시

hello,
I can't understand what I am doing wrong. the main code I am attaching is calling an external called "function". I added the external function as an additional file.
I am adding the error message as a photo.
pleas help!
thanks!!!
clear all
close all
clc
global M_rand index
n_iter=10; %number of iterations
var=1.5/100; %variation around the nominal value
M_rand=zeros(9,n_iter);
random_variables=zeros(9,n_iter);%columns of t1 w0 w11 t2 w12 w21 w22 T1 T2
random_variables_nom=[32.2,2797.64,1222.18,138.2,944.187,180.03,45.35,12221.82,1801.75]; %t1 w0 w11 t2 w12 w21 w22 T1 T2
random_variables_range=zeros(9,2);%columns of t1 w0 w11 t2 w12 w21 w22 T1 T2, while the first column in min and the second is max
for range_counter=1:1:9
random_variables_range(range_counter,1)=random_variables_nom(range_counter)*(1-var);
random_variables_range(range_counter,2)=random_variables_nom(range_counter)*(1+var);
end
for rand_counter=1:1:9
temp(rand_counter,:)=random_variables_range(rand_counter,1)+(random_variables_range(rand_counter,2)-random_variables_range(rand_counter,1))*rand(1,n_iter);
end
M_rand=temp;
g=9.8;
GM=0.039; %in MKS
q0=[0;(6.3782448*(10^6));10.585;60.03];
t_delta=0.01
t_span=[0:t_delta:150];
t=0;
F=@(t,q) [q(2);(-GM*(q(1)/(((q(1)^2)+q(3)^2)^1.5)))+(g*Functions(t_iter))*(q(2)/(((q(2)^2)+(q(4)^2))^0.5));q(4);(-GM*(q(3)/(((q(1)^2)+q(3)^2)^1.5)))+(g*Functions(t_iter))*(q(4)/(((q(2)^2)+(q(4)^2))^0.5))];
for counter_iter=1:1:n_iter
index=counter_iter;
for time=1:t_delta:length(t_span)
t_iter=time;
[t,q]=ode45(@(t,q) F(t,q),t_span,q0);
plot(t,q(1,:),'g')
hold on
plot(t,q(1,:),'g')
end
figure
end
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!