ho to apply upper boundary for cumulaitive percentage

1 次查看(过去 30 天)
l=input('l=')
g = zeros(1, length(0:100));% initialize g with 0's of length t
c = 1;% counter variable
for t=0:100
if t>2 && t<=80
g(c)=((3/(309*1.465))*((((12.6*(t-2))/l)*80.4)-(l/6)));
elseif t>80
g(c)=1-((80.4/309)*exp(((((-3*12.6)/(1.465*l))*(t-80)))));
else
g(c)=0;
end
c = c+1;% increment counter variable
end
format shortG
g
t=0:100;
gs = cumsum(g);
gs = gs / gs(end) * 100;
plot(t,gs,'r')
xlabel('Day')
ylabel('Cumulative percentage of nutrient release,%')
this is my coding and i have to apply the up boundary for cumulative percentage of g which is 73%. so can someone help me
  4 个评论
Rik
Rik 2020-1-31
You will have to be a little bit more verbose. When I run your code (setting L to 1), I don't see anything related to 73% showing up. I get a normal graph, so I don't see your issue.
Relatedly, you really shouldn't use a lower case L as a variable name. It is difficult to distinguish from the number 1.
Pravin Jagtap
Pravin Jagtap 2020-2-4
Hello Liyana,
The statement 'i have to apply the up boundary for cumulative percentage of g which is 73%' is not clear. I found the attached output for 'l=2'. Does that mean you dont want values in g vector above 73? We need some more clarity on question.
figure1.png

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by