I get different solutions from ODE45

조회 수: 1 (최근 30일)
Emir Dönmez
Emir Dönmez 2023년 2월 28일
댓글: Torsten 2023년 2월 28일
I tried to solve MIT's open courseware MatLab assigments. On the assigment they wanted plot different colors of lines depending on their value if it bigger than zero it would be red, it isn't it would black.
Here is the differential system and constans values.
My ODE45 function's code.
function dif_system = diferantial(t, x);
% Solver for the differantial system
% alphan(V), alphah(V), alpham(V), betan(V), betam(V), betah(V)
% these are the funciton scripts MIT gave us to use.
n = x(1);
m = x(2);
h = x(3);
V = x(4);
An = alphan(V); Bn = betan(V);
Am = alpham(V); Bm = betam(V);
Ah = alphah(V); Bh = betah(V);
% Membrane Capaticane
C = 1;
% Conductances
Gk = 36; % Potassium
Gna = 120; % Sodium
Gl = 0.3; % Leak channels
% Reversal potetias
Ek = -72; % Potassium
Ena = 55; % Sodium
El = -49.4; % Leak channels
dif_system = [(1-n)*An-(n*Bn);
(1-m)*Am-(m*Bm);
(1-h)*Ah-(h*Bh);
-C^-1*(Gk*n^4*(V-Ek)+Gna*m^3*h*(V-Ena)+Gl*(V-El))];
end
When i run the code my whole values are bigger than the zero(I shoved it down below).
Where i'm doing wong?
  댓글 수: 7
Emir Dönmez
Emir Dönmez 2023년 2월 28일
I know some problem in the conditions or equetions that's way i asked.
Torsten
Torsten 2023년 2월 28일
Usually, we cannot find modelling errors. We can only help with MATLAB syntax errors and sometimes with solver problems.

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

답변 (1개)

Walter Roberson
Walter Roberson 2023년 2월 28일
Plotting the whole line in red if the voltage peak for the line is above 0 is what the question asks. It does not ask for the part of the line above 0 to be plotted in red.
Look for example at the wording about zooming in to see the threshold that separates the red lines from the black lines: that is definitely talking about red for the entire lines, not for line segments.
  댓글 수: 1
Emir Dönmez
Emir Dönmez 2023년 2월 28일
I understood on the what they want me on the question, they wanted me to paint depending on peak values but the problem is whole lines peak values are way bigger than the zero.

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by