How to plot the log scale?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Esraa Abdelkhaleq
am 9 Mai 2017
Kommentiert: Star Strider
am 9 Mai 2017
If I have the following code:
syms t x ai di Kgr dc fc Rc fi_Ri Kei Kec fch_Rch_Nh0 fih_Rih_Nh0
g = @(t,x,ai,di,Kgr,dc,fc,Rc,fi_Ri,Kei,Kec,fch_Rch_Nh0,fih_Rih_Nh0)[Kgr*x(1)-dc*x(1)*x(2);ai*x(1)-di*x(2);fc*Rc*x(1)+fch_Rch_Nh0-Kec*x(3);fi_Ri*x(2)+fih_Rih_Nh0-Kei*x(4)]
ai=0.0474; di=0.1131; Kgr=5.78*10^(-3); dc=0.2*10^(-10); fc=0.1; Rc=4.5*10^(-5); fi_Ri=10.925*10^(-4); Kec=0.11; Kei=2.14;fch_Rch_Nh0=4.56*10^(1); fih_Rih_Nh0=7.16*10^(2) ;
cutoff1=34.11*3150; cutoff2=3.8*3150; threshold1= 1.5*3150; threshold2= 1*3150;
[t,xa] = ode45(@(t,x) g(t,x,ai,di,Kgr,dc,fc,Rc,fi_Ri,Kei,Kec,fch_Rch_Nh0,fih_Rih_Nh0),[0 4000],[1 1 0 0]);
figure
plot(t,xa(:,3),'r')
hline1=refline(0,cutoff1);
hline2=refline(0,threshold1);
set(hline1,'color','g','LineStyle','--')
set(hline2,'color','g','LineStyle','-')
hold on
plot(t,xa(:,4),'color','b')
hline3=refline(0,cutoff2);
hline4=refline(0,threshold2);
set(hline3,'color','b','LineStyle','--')
hline4.Color='m';
xlabel ('Time')
ylabel ('q_{PL}(t)')
title(['Tumor & Immune Biomarkers Shedding also by Healthy Cells'])
How can I plot t versus log x(3) and log x(4) instead of plot(t,xa(:,3))and plot(t,xa(:,4)) contained in the code? can I write plot(t,log (xa(:,3))) and plot((t,log (xa(:,4)))?
Thanks in advance.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 9 Mai 2017
‘can I write plot(t, log(xa(:,3))) and plot((t, log(xa(:,4)))?’
Yes, or you can use the semilogy plot:
semilogy(t, xa(:,3))
semilogy(t, xa(:,4))
2 Kommentare
Star Strider
am 9 Mai 2017
My pleasure.
The results appear to be different, because of the scaling on the y-axis. With your original code, the units will be in terms of ‘log(xa(:,c))’ (where ‘c’ is the column you choose). With semilogy, they will be in powers of 10.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric 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!