フィルターのクリア

Plotting real data and prediction

2 ビュー (過去 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 Center および File ExchangeBiological and Health Sciences についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by