Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
non linear differential system
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hello to all the community i want to solve that non linear system but most likely i do something wrong
firstly i interpolate the f1,f2 then i differentiate C using diff(C,x) and diff(C,y) and put it in the left side of the equation like this
normally it has to be desceading function.but the plot of my code have increasing function
what i do wrong?
the code is
format long
global k %copula parameter
ft=0:5:120; % ages
tau =0.10; % we choose kendall tau
k = copulaparam('Frank',tau); %we transfor kentall tau to copula parameter
fc2=xlsread('data.xlsx','N2:N26');%our data
fo2=xlsread('data.xlsx','O2:O26');
tspan = [0:5:120];% we need to estimate appropriate t-span
ic=[1 1]; %initial conditions
opts = odeset('RelTol',1e-2,'AbsTol',1e-4); % we choose the maximum tollarance from our solution
[t,y] = ode45(@(t,y)my(t,k,y,fc2,fo2,tspan), tspan,ic, opts); %we call the function
plot(t,y(:,1),'-o',t,y(:,2),'-.') %plot
title('Net survival functions (Using Frank copula with theta=0.9074 kendalltau =0.1) ')
legend('S-net cancer','S-net other causes')
and the function
function dydt = my(t,k,y,fc2,fo2,ft,fcc2,foo2)
dydt = zeros(2,1);
fcc2 = interp1(ft,fc2,t); % Interpolate the data set (ft,f1) at time t
foo2 = interp1(ft,fo2,t); % Interpolate the data set (ft,f2) at time t
dydt(1) = fcc2/((exp(-k*y(1))*(exp(-k*y(2)) - 1))/(exp(-k) + (exp(-k*y(1)) - 1)*(exp(-k*y(2)) - 1) - 1));
dydt(2) =foo2/((exp(-k*y(2))*(exp(-k*y(1)) - 1))/(exp(-k) + (exp(-k*y(2)) - 1)*(exp(-k*y(1)) - 1) - 1));
the time dependent term can be found here (Cells N,O)
i would be really appreciate if someone help me because i dont know what to do wrong
4 Kommentare
Walter Roberson
am 28 Feb. 2018
Why are you defining my with 8 parameters but only passing in 6?
Why are you using such an odd order of parameters for code that is under your control? Coding conventions matter when you are not the only person reading the code.
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!