Clear Filters
Clear Filters

I get different solutions from ODE45

3 views (last 30 days)
Emir Dönmez
Emir Dönmez on 28 Feb 2023
Commented: Torsten on 28 Feb 2023
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 Comments
Emir Dönmez
Emir Dönmez on 28 Feb 2023
I know some problem in the conditions or equetions that's way i asked.
Torsten
Torsten on 28 Feb 2023
Usually, we cannot find modelling errors. We can only help with MATLAB syntax errors and sometimes with solver problems.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 28 Feb 2023
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 Comment
Emir Dönmez
Emir Dönmez on 28 Feb 2023
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.

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!