How to plot c(t) vs t
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
vetri veeran
am 12 Aug. 2014
Kommentiert: Yu Jiang
am 12 Aug. 2014
How to plot c(t) vs t with these parameters for various values of v
c(t)=c0-c03*k*(1/cmin-1/cmax)*v*u(t)
where,
u(t)=1, t≥0
0, t<0
Cmin=10e-9
Cmax=10e-6
C0=100e-9
K=10e6
Thanks in advance
0 Kommentare
Akzeptierte Antwort
Yu Jiang
am 12 Aug. 2014
Bearbeitet: Yu Jiang
am 12 Aug. 2014
I would first define a function as follows:
function y = Cfun(t, v)
u = double(t>=0);
Cmin = 10e-9;
Cmax = 10e-6;
C0 = 100e-9;
K = 10e6;
C03 = C0; % I don't know what C03 is, so I set it the same as C0.
y = C0-C03*K*(1/Cmin-1/Cmax)*v*u;
end
Then, create a different MATLAB file with the following code
t = linspace(-10,10,100);
y = [];
for v = [1,5,-1,-5]
y = [y; Cfun(t,v)];
end
plot(t,y(1,:),t,y(2,:),t,y(3,:),t,y(4,:))
legend('v=1', 'v=5', 'v=-1', 'v=-5')
Then, you should be able to see the figure as expected.
-Yu
5 Kommentare
Yu Jiang
am 12 Aug. 2014
Did you put them into to different MATLAB files and execute the script file? It seems to me that you are executing the function file.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance 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!