sinan

버전 1.1 (172 KB) 작성자: Muhammad Sinan
The generated figures are added.
다운로드 수: 7
업데이트 날짜: 2023/9/3

라이선스 보기

clear all; clc; close all; clf;
sinan = sinan();
t0 = 0; tfinal = 60; N = 100;
h = (tfinal-t0)/N;
t = t0:h:tfinal;
%% Initial conditions
y0=[100, 10, 20];
y01=[100];
%% Parameters
Lambda = 0.1; beta = 0.4; mu = 0.01; gamma = 0.7; % parameters for model 1
a = 0.2; % parameter for model 2
Models
SIR Epidemic model
Susceptible Class
subject to
Initial conditions
Decay model
decay model
subject to Initial condition
%% Models
model_1 = @(t, X) [Lambda- beta*X(1)*X(2);
beta*X(1)*X(2)-(gamma+mu)*X(2);
mu*X(2)];
model_2 = @(t, y) -a*y;
% fractional order
alpha = 1;
% Choose a solver
solver_1 = 'caputo';
solver_2 = 'abc';
solver_3 = 'CLASSICAL';
% How to solve a system of equations?
[t_euler_caputo_1, y_euler_caputo_1] = sinan.euler(model_1, alpha, t, h, y0, solver_1);
[t_euler_ABC_1, y_euler_ABC_1] = sinan.euler(model_1, alpha, t, h, y0, solver_2);
[t_euler_clas_1, y_euler_clas_1] = sinan.euler(model_1, alpha, t, h, y0, solver_3);
[t_rk4_caputo_1, y_rk4_caputo_1] = sinan.rk4(model_1, alpha, t, h, y0, solver_1);
[t_rk4_ABC_1, y_rk4_ABC_1] = sinan.rk4(model_1, alpha, t, h, y0, solver_2);
[t_rk4_clas_1, y_rk4_clas_1] = sinan.rk4(model_1, alpha, t, h, y0, solver_3);
% How to solve an equation?
[t_euler_caputo_2, y_euler_caputo_2] = sinan.euler(model_2, alpha, t, h, y01, solver_1);
[t_euler_ABC_2, y_euler_ABC_2] = sinan.euler(model_2, alpha, t, h, y01, solver_2);
[t_euler_clas_2, y_euler_clas_2] = sinan.euler(model_2, alpha, t, h, y01, solver_3);
[t_rk4_caputo_2, y_rk4_caputo_2] = sinan.rk4(model_2, alpha, t, h, y01, solver_1);
[t_rk4_ABC_2, y_rk4_ABC_2] = sinan.rk4(model_2, alpha, t, h, y01, solver_2);
[t_rk4_clas_2, y_rk4_clas_2] = sinan.rk4(model_2, alpha, t, h, y01, solver_3);
figure(1)
plot(t_euler_caputo_1, y_euler_caputo_1(:, 1), 'r', t_euler_ABC_1, y_euler_ABC_1(:, 1), 'b', t_euler_clas_1, y_euler_clas_1(:, 1), 'k')
legend('Euler caputo', 'Euler abc', 'Euler classical')
figure(2)
plot(t_rk4_caputo_1, y_rk4_caputo_1, 'r', t_rk4_ABC_1, y_rk4_ABC_1, 'b', t_rk4_clas_1, y_rk4_clas_1, 'k')
legend('rk4 caputo', 'rk4 abc', 'rk4 classical')
figure(3)
plot(t_euler_clas_1, y_euler_clas_1, 'r', t_rk4_clas_1, y_rk4_clas_1, 'b')
legend('euler classical', 'rk4 classical')
figure(4)
plot(t_euler_caputo_2, y_euler_caputo_2, 'r', t_euler_ABC_2, y_euler_ABC_2, 'b', t_euler_clas_2, y_euler_clas_2, 'k')
legend('Euler caputo', 'Euler abc', 'Euler classical')
xlabel('time (t)')
ylabel('y(t)')
figure(5)
plot(t_rk4_caputo_2, y_rk4_caputo_2, 'r', t_rk4_ABC_2, y_rk4_ABC_2, 'b', t_rk4_clas_2, y_rk4_clas_2, 'k')
legend('rk4 caputo', 'rk4 abc', 'rk4 classical')
xlabel('time (t)')
ylabel('y(t)')
figure(6)
plot(t_euler_clas_2, y_euler_clas_2, 'r', t_rk4_clas_2, y_rk4_clas_2, 'b')
legend('euler classical', 'rk4 classical')
xlabel('time (t)')
ylabel('y(t)')

인용 양식

Muhammad Sinan (2026). sinan (https://kr.mathworks.com/matlabcentral/fileexchange/132812-sinan), MATLAB Central File Exchange. 검색 날짜: .

Sinan, Muhammad. Sinan. Zenodo, 2023, doi:10.5281/ZENODO.8189815.

양식 더 보기
MATLAB 릴리스 호환 정보
개발 환경: R2022b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가
버전 게시됨 릴리스 정보
1.1

The howTO file with some changes and the figures generated and the howTO file are added. You can check the default results for your guidance.

1.0