Matlab coding

Lukket Lagt ut 2 år siden Betales ved levering
Lukket Betales ved levering

I would to solve two nonlinear differential equations with 2 variables on the same time

Also I already wrote all parameters

T, t0, m, p1, p2, q1, q2, c1, c2, h=T/m and calculations of alpha , beta , v1, v2, x1_hat, x2_hat, u1_hat, u2_hat, l1, l2, L1, L2, a1, a2, a3, a4, a5

Just you need to solve two nonlinear differential equations of x1 and x2 in the same time

Solve dx1/dt and d x2/dt and find u1 of t and u2 of t

%% Numerical Example

% Clear data and figures

clc; clear all

% Initialize Parameter

T = 40; t0 = 0; m = 80; p1 = 1; q1 = 10; c1 = 25; p2 = 1; q2 = 10; c2 = 25;

h = T/m;

% Symbloic represetation

syms t

% Calculate alpha and beta

alpha = m*(m-1)/2; beta = m*(m-1)*(2*m-1)/6;

% Define Repair rate v1

v1 = @(t) 1/(1+t);

% Define Repair rate v2

v2 = @(t) 1/(1+t);

% Define Target Probability x1_hat

x1_hat = @(t) 1/(40+cos(t));

% x1_hat'

dx1_hat = matlabFunction(diff(x1_hat(t)));

% Define Target Probability x2_hat

x2_hat = @(t) 1/(40+cos(t));

% x2_hat'

dx2_hat = matlabFunction(diff(x2_hat(t)));

% Calculate u1_hat

u1_hat = @(t) (1/x2_hat(t))*(v1(t)*x1_hat(t) - dx2_hat(t));

% Calculate u2_hat

u2_hat = @(t) (1/(1 - x1_hat(t) - x2_hat(t)))*(v2(t)*x1_hat(t) + dx1_hat(t) + dx2_hat(t));

% Calculate L1(t),L2(t),l1(t)and l2(t)

L1(t) = @(t) p1*h^2*(alpha -beta*h*(v1(t)+v2(t)+u2_hat(t)))+2*h*m*((h*p1/4)+(c1/2))*(1- h*m*(v1(t0)+v2(t0)+u2_hat(t)));

L2(t) = @(t) beta*p1*h^3*(u1_hat(t)-u2_hat(t))+2*h^2*m^2*((h*p1/4)+(c1/2))*(u1_hat(t)-u2_hat(t));

l1(t) = @(t) p1*h^2*(alpha -beta*h*(v1(t)+v2(t)+u2_hat(t)))-beta*p2*h^3*v1(t)+2*h*m*((h*p1/4)+(c1/2))*(1- h*m*(v1(t0)+v2(t0)+u2_hat(t)))-2*h^2*m^2*((h*p2/4)+(c2/2))*v1(t);

l2(t) = @(t) beta*p1*h^3*(u1_hat(t)-u2_hat(t))+(alpha -beta*h*u1_hat(t))+(2*h^2*m^2*((h*p1/4)+(c1/2))*(u1_hat(t)-u2_hat(t)))-2*h*m*((h*p1/4)+(c1/2))*(1-h*m*u1_hat(t));

% Calculate a1(t), a2(t), a3(t), a4(t) and a5(t)

a1(t) = @(t) h*q1/4+(((p1/2)+(p2/2))*beta*h^3+((h*p1/4)+(c1/2))*h^2*m^2+((h*p2/4)+(c2/2))*h^2*m^2)*x2(t)^2;

a2(t) = @(t) h*q2/4+((beta*p1*h^3/2)+((h*p1/4)+(c1/2))*2*h^2*m^2)*(1-x1(t)-x2(t))^2;

a3(t) = @(t) (beta*p1*h^3+((h*p1/4)+(c1/2))*2*h^2*m^2)*(1-x1(t)-x2(t))*x2(t);

a4(t) = @(t) l1(t)*x2(t)*(x1(t)-x1_hat(t)) + l2(t)*x2(t)*(x2(t)-x2_hat(t));

a5(t) = @(t) L1(t)*(1-x1(t)-x2(t))*(x1(t)-x1_hat(t)) + L2(t)*(1-x1(t)-x2(t))*(x2(t)-x2_hat(t));

% Nonlinear Differential Equations

Nonlin_eq1 = @(t,x1) -(v1(t)+v2(t))*x1(t) + (u1_hat(t) + ((2*a2(t)*a4(t)-a3(t)*a5(t))/(a3(t)^2-4*a1(t)*a2(t))))*x2(t) + (u2_hat(t) + ((2*a1(t)*a5(t)-a3(t)*a4(t))/(a3(t)^2-4*a1(t)*a2(t))))*(1-x1(t)-x2(t));

Nonlin_eq2 = @(t,x2) -(u1_hat(t) + ((2*a2(t)*a4(t)-a3(t)*a5(t))/(a3(t)^2-4*a1(t)*a2(t))))*x2(t) + v1(t)*x1(t);

Matlab and Mathematica Matematikk Elektrisk ingeniørvitenskap Algoritme Ingeniørvitenskap

Prosjekt-ID: #32093992

Om prosjektet

5 bud Eksternt prosjekt Aktiv 2 år siden

5 frilansere byr i gjennomsnitt $32 for denne jobben

doggar302

Hi Employer! I am a Matlab developer and have been working for the last 6 years. I am able to do this job. I have checkout the description. You can also checkout my portfolio. https://www.freelancer.com/u/doggar30 Mer

$50 USD på 1 dag
(26 Omtaler)
5.7
alamineee

Hi, Dear Employer, I have read your job post carefully. I have over seven-plus years of experience at the ✔Machine Learning ✔python ✔Matlab ✔C program, ✔C++ program. ✔R program, ✔Algorithm✔java, and others. Please fee Mer

$20 USD på 1 dag
(9 Omtaler)
4.1
shashaev96

Professional Mathematician and master in Matlab️ Hello , I hope you are safe and Doing well I have seen your project requirements , I am looking to discuss further with you Hope we will meet soon to discuss further Mer

$20 USD på 1 dag
(9 Omtaler)
3.7
salehinfaijus360

Hi there, I'm "Salehin Mohammad F,EEE engineer; I am an expert in professionalization in essays and dissertations with skills including ✓ Matlab and Mathematics ✓Machine learning ✓Python ✓JAVA program Mathematics, and Mer

$50 USD på 1 dag
(4 Omtaler)
2.5