Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How do I correctly plot this function?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello, I'm trying to generate a plot with the x I found, which was 92, that shows a curve that is just below the limit, which is 50. I can't seem to get a smooth plot/curve. I think it's because I might be plotting the wrong data. Any ideas on what I'm doing wrong? The rest of the code should be correct, it's just the plotting towards the end. Thank you!
function y = glucose_response_f(tt,K,tau,x)
syms t s
u = 5*((heaviside(t)-heaviside(t-5))+(heaviside(t-x)-heaviside(t-(x+5))));
U = laplace(u);
T = K/(s+1/tau)^2;
yt = ilaplace(T*U);
pretty(yt);
y = subs(yt,{t},tt);
disp('')
disp(['y=' num2str(double(y)) '[%]'])
end
%Command window
tt = [0 25 50 75 100 125 150 175 200];
K=0.1;
tau=40;
x=92;
y = glucose_response_f(tt,K,tau,x);
%Ans
heaviside(t - 5) (1600 #3 + 40 #3 (t - 5) - 1600) / t \ / t \
------------------------------------------------- - t exp| - -- | 20 - exp| - -- | 800
2 \ 40 / \ 40 /
heaviside(t - 92) (1600 #2 + 40 #2 (t - 92) - 1600)
- ---------------------------------------------------
2
heaviside(t - 97) (1600 #1 + 40 #1 (t - 97) - 1600)
+ --------------------------------------------------- + 800
2
where
/ 97 t \
#1 == exp| -- - -- |
\ 40 40 /
/ 23 t \
#2 == exp| -- - -- |
\ 10 40 /
/ 1 t \
#3 == exp| - - -- |
\ 8 40 /
y=0 31.9969 36.2006 29.5863 33.179 49.8597 43.87 32.6788 22.4144[%]
plot(tt,y)
댓글 수: 4
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
