|
Hi,
I think I am facing a simple problem here.
I want to construct a new function Pn, which is defined as a ratio of two functions
tauA and tauB on interval x>0.5, and is defined as a ratio of tauB and tauA on the interval x<=0.5. I wrote the Matlab code below, but it seems it does calculate pN function ALWAYS as a ratio of tauB to tauA, so it does not calculate it in a way I want on in the interval x>0.5.
I also tried other specifications with while, and elseif .. it does not work. Can you pls help? Many thanks.
x=linspace(0,1);
y = 0.5;
tauA=(y./(1-x)).^(1/2);
tauB=(x./(1-y)).^(1/2);
plot(x,tauA,x,tauB)
if x>0.5
pN=tauA./tauB;
else
pN=tauB./tauA;
end
plot(x,tauA,x,tauB,x,pN)
|