Plotting real data and prediction

1 Ansicht (letzte 30 Tage)
Sunday Aloke
Sunday Aloke am 21 Jun. 2022
Kommentiert: Sunday Aloke am 21 Jun. 2022
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 Kommentare
KSSV
KSSV am 21 Jun. 2022
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 am 21 Jun. 2022
Please how do I check it or do I send you the file??

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Biological and Health Sciences finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by