Filter löschen
Filter löschen

I have sigmoid graph and I want to stop the time until 4th and continue from day 10th until day 30th. Can I make like this?

3 Ansichten (letzte 30 Tage)
M1(1)=0;
t(1)=0;
h=0.01;
dt=-5:h:30;
t=zeros(length(dt),1);
M1=zeros(length(dt),1);
for i= 1:length(dt)
t(i+1)=t(i)+h*i;
M11=M1(i)+1./(1+exp(-dt));
end
plot(dt,M11,'k','Linewidth',3);
xlabel('Time (day)','Fontsize',14,'FontWeight','bold');
ylabel('Concentration (g/mL)','Fontsize',12,'FontWeight','bold');
  4 Kommentare
cindyawati cindyawati
cindyawati cindyawati am 29 Feb. 2024
Thank you for your response, I mean I want to break the graph until 15 th and continue the graph from 25th. It is possible?
Mathieu NOE
Mathieu NOE am 4 Mär. 2024
see this Fex submission
you get this nice looking result with only one extra line of code : (and no need for the for loop as already mentionned by @Torsten)
h=0.01;
dt=-5:h:30;
M11 = 1./(1+exp(-dt));
plot(dt,M11)
%Break The Axes
h = breakxaxis([15 25]);

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Chunru
Chunru am 29 Feb. 2024
M1(1)=0;
t(1)=0;
h=0.01;
dt=-5:h:30;
t=zeros(length(dt),1);
M1=zeros(length(dt),1);
for i= 1:length(dt)
t(i+1)=t(i)+h*i;
M11=M1(i)+1./(1+exp(-dt));
end
ind = dt>=15 & dt<=25;
M11(ind) = nan;
plot(dt,M11,'k','Linewidth',3);
xlabel('Time (day)','Fontsize',14,'FontWeight','bold');
ylabel('Concentration (g/mL)','Fontsize',12,'FontWeight','bold');

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements 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