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 次查看(过去 30 天)
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 个评论
Mathieu NOE
Mathieu NOE 2024-3-4
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]);

请先登录,再进行评论。

采纳的回答

Chunru
Chunru 2024-2-29
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');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by