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?

1 view (last 30 days)
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 Comments
cindyawati cindyawati
cindyawati cindyawati on 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 on 4 Mar 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]);

Sign in to comment.

Accepted Answer

Chunru
Chunru on 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');

More Answers (0)

Community Treasure Hunt

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

Start Hunting!