필터 지우기
필터 지우기

Plotting real data and prediction

조회 수: 6 (최근 30일)
Sunday Aloke
Sunday Aloke 2022년 6월 21일
댓글: Sunday Aloke 2022년 6월 21일
I have a real data in excel, I want to make a future prediction.I have the following code but it only produce figure from the current data.
clc clear
%% % Reading the data from .xlsx file path (path,'C:\Users\User\Desktop\MSC PRO%');
[num, txt, raw] = xlsread('Book1.xlsx','data pull'); TN = xlsread('Book1.xlsx','data pull');
%% % Initializing the variable ID = (TN(:,1)); N = 200000000; I = (TN(:,3)); E = 4.*I; R = (TN(:,5)); D = (TN(:,7)); X = (E + I + R + D); S = N - X;
s = S/N; e = E/N; i = I/N; r = R/N; d = D/N;
%% %plotting the current data figure(1); plot(ID, I,'r',ID,R,'b',ID, D,'y'); xlabel('Days'); ylabel('population'); legend('Confirmed', 'Recovered','Death'); %% % finding apha1,apha3, apha4 and apha5 alpha1 = -1*(1/5.*e + diff(s) + diff(d) + diff(r) + diff(r))./(s.*i); alpha1(isnan(alpha1)) = []; alpha1(isinf(alpha1)) = []; alpha1 = mean(alpha1);
alpha3 = (1/5.*e - diff(d) - diff(i))./(i); alpha3(isnan(alpha3)) = []; alpha3(isinf(alpha3)) = []; alpha3 = mean(alpha3);
alpha4 = diff(d)./(i); alpha4(isnan(alpha4)) = []; alpha4(isinf(alpha4)) = []; alpha4 = mean(alpha4);
alpha5 = (1/5.*e - diff(d) - diff(i) - diff(r))./(r); alpha5(isnan(alpha5)) = []; alpha5(isinf(alpha5)) = []; alpha5 = mean(alpha5);
%% %Slving the equations t0 = 0; tf = 756; y0 = [s(end) e(end) i(end) r(end) d(end)]; [t y] = ode45('ypseird',[t0 tf],y0);
%% %plotting the prediction figure(2) plot(t,y(:,1),t,y(:,2),t,y(:,3),t,y(:,4),t,y(:,5)) title('SEIRD Model'); xlable('Times') ylable('fraction of the Population') legend('Susciple','Exposed', 'Infected', 'Recovered', 'Death')
The following are the errors. 1. Error using ==> plus Matrix dimensions must agree. Error in ==> seird at 40 alpha1 = -1*(1/5.*e + diff(s) + diff(d) + diff(r) + diff(r))./(s.*i);
2. Error in ==> seird at 43 [t y] = ode45('ypseird',[t0 tf],y0);
Please I need assistant.
  댓글 수: 2
KSSV
KSSV 2022년 6월 21일
Error is clear, you need to check the dimensions of the arrays which you are using. We cannot check as the input files are not with us.
Sunday Aloke
Sunday Aloke 2022년 6월 21일
Please how do I check it or do I send you the file??

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Biological and Health Sciences에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by