Using two models on a function and plot it.

Hello.
I want to plot a function of x. Where at one value of x the mathematical model changes. How would I do that?
This is my code and the two models are rLin and rMet. When "Vsn" reaches a value of 0.95 the rMet model is used, before that rLin is used if "Vsn" > 0.
tx = 40 * 10^-10;
ex = 3.45*10^-13;
on = 180;
Vn = 0.25;
WLn = 0.12/1.4;
B = (on * (ex/tx)*WLn);
rLin = @(Vsn) B*(1.2 - Vn - (Vsn/2)).*Vsn;
rMet = @(Vsn) (B/2)*(1.2 - Vn)^2;

回答(1 个)

Try this:
VsnFcn = @(Vsn) rLin(Vsn).*(Vsn >0 & Vsn<=0.95) + rMet(Vsn).*(Vsn>0.95);
also note that ‘rMet’ does not actually use ‘Vsn’ in its calculation.

类别

帮助中心File Exchange 中查找有关 Scatter Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by