I get different solutions from ODE45
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Torsten
il 28 Feb 2023
Usually, we cannot find modelling errors. We can only help with MATLAB syntax errors and sometimes with solver problems.
Risposte (1)
Walter Roberson
il 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.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!