changing the scale on the Y axis
Good evening sir
Sir I need -1 to 1 on Y-axis but i got this on X-axis. Now I request you please help me how to getting -1 to 1 on Y-axis. I attached my code and graph relating to my code.
Code:
xmesh1 = linspace(-1,0,10);
xmesh2 = linspace(0,1,10);
xmesh = [xmesh1,xmesh2];
yinit = [0 1 0 1 0 1 0 1];
init = bvpinit(xmesh,yinit);
sol = bvp5c(@f, @bc, init);
plot(sol.x,sol.y(2,:),’b-o’,sol.x,sol.y(3 ,:),’r-o’)
%line([1 1], [0 1], ‘Color’, ‘k’)
% legend(‘y1′,’y3’)
% % title(‘A Three-Point BVP Solved with bvp5c’)
% xlabel({‘x’, ‘lambda = 2, kappa = 5’})
% ylabel(‘v(x) and C(x)’)
hold on
function dydx = f(x,y,region) % equations being solved
W=1;alpha=1;M=2;k1=1;k2=1;k3=1;k4=1;k=1; Ps=1;Po=1;R1=0;R2=2;
omega=1;
us = y(1);
usy = y(2);
uo = y(3);
u0y = y(4);
thetas = y(5);
thetasy = y(6);
thetao = y(7);
thetaoy = y(8);
dydx = zeros(8,1);
switch region
case 1 % x in [-1 0]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k2)*us – alpha*Ps*R2;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R2)*uo – alpha*Po*R2; % 1/K2 ?
dydx(5) = thetasy+thetas;
dydx(6) = k1*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k3*thetasy*thetaoy;
case 2 % x in [0 1]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k1)*us – Ps*R1;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R1)*uo – Po*R1;
dydx(5) = thetasy;
dydx(6) = k2*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k4*thetasy*thetaoy;
end
end
function res = bc(YL,YR)
mu1=1; mu2=1; k1=1; k2=1;
res = [YL(1,1)
YL(3,1)
YL(5,1)
YL(7,1)
YR(1,2)-1
YR(3,2)-1
YR(5,2)-1
YR(7,2)
YR(1,1)-YL(1,2)
mu1*YR(2,1)-mu2*YL(2,2)
YR(3,1)-YL(3,2)
mu1*YR(4,1)-mu2*YL(4,2)
YR(5,1)-YL(5,2)
k1*YR(6,1)-k2*YL(6,2)
YR(7,1)-YL(7,2)
k1*YR(8,1)-k2*YL(8,2)];
end
The graph relating to code is
But I need the -1 to 1 range on Y-axis like the following graph:Good evening sir
Sir I need -1 to 1 on Y-axis but i got this on X-axis. Now I request you please help me how to getting -1 to 1 on Y-axis. I attached my code and graph relating to my code.
Code:
xmesh1 = linspace(-1,0,10);
xmesh2 = linspace(0,1,10);
xmesh = [xmesh1,xmesh2];
yinit = [0 1 0 1 0 1 0 1];
init = bvpinit(xmesh,yinit);
sol = bvp5c(@f, @bc, init);
plot(sol.x,sol.y(2,:),’b-o’,sol.x,sol.y(3 ,:),’r-o’)
%line([1 1], [0 1], ‘Color’, ‘k’)
% legend(‘y1′,’y3’)
% % title(‘A Three-Point BVP Solved with bvp5c’)
% xlabel({‘x’, ‘lambda = 2, kappa = 5’})
% ylabel(‘v(x) and C(x)’)
hold on
function dydx = f(x,y,region) % equations being solved
W=1;alpha=1;M=2;k1=1;k2=1;k3=1;k4=1;k=1; Ps=1;Po=1;R1=0;R2=2;
omega=1;
us = y(1);
usy = y(2);
uo = y(3);
u0y = y(4);
thetas = y(5);
thetasy = y(6);
thetao = y(7);
thetaoy = y(8);
dydx = zeros(8,1);
switch region
case 1 % x in [-1 0]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k2)*us – alpha*Ps*R2;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R2)*uo – alpha*Po*R2; % 1/K2 ?
dydx(5) = thetasy+thetas;
dydx(6) = k1*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k3*thetasy*thetaoy;
case 2 % x in [0 1]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k1)*us – Ps*R1;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R1)*uo – Po*R1;
dydx(5) = thetasy;
dydx(6) = k2*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k4*thetasy*thetaoy;
end
end
function res = bc(YL,YR)
mu1=1; mu2=1; k1=1; k2=1;
res = [YL(1,1)
YL(3,1)
YL(5,1)
YL(7,1)
YR(1,2)-1
YR(3,2)-1
YR(5,2)-1
YR(7,2)
YR(1,1)-YL(1,2)
mu1*YR(2,1)-mu2*YL(2,2)
YR(3,1)-YL(3,2)
mu1*YR(4,1)-mu2*YL(4,2)
YR(5,1)-YL(5,2)
k1*YR(6,1)-k2*YL(6,2)
YR(7,1)-YL(7,2)
k1*YR(8,1)-k2*YL(8,2)];
end
The graph relating to code is
But I need the -1 to 1 range on Y-axis like the following graph: Good evening sir
Sir I need -1 to 1 on Y-axis but i got this on X-axis. Now I request you please help me how to getting -1 to 1 on Y-axis. I attached my code and graph relating to my code.
Code:
xmesh1 = linspace(-1,0,10);
xmesh2 = linspace(0,1,10);
xmesh = [xmesh1,xmesh2];
yinit = [0 1 0 1 0 1 0 1];
init = bvpinit(xmesh,yinit);
sol = bvp5c(@f, @bc, init);
plot(sol.x,sol.y(2,:),’b-o’,sol.x,sol.y(3 ,:),’r-o’)
%line([1 1], [0 1], ‘Color’, ‘k’)
% legend(‘y1′,’y3’)
% % title(‘A Three-Point BVP Solved with bvp5c’)
% xlabel({‘x’, ‘lambda = 2, kappa = 5’})
% ylabel(‘v(x) and C(x)’)
hold on
function dydx = f(x,y,region) % equations being solved
W=1;alpha=1;M=2;k1=1;k2=1;k3=1;k4=1;k=1; Ps=1;Po=1;R1=0;R2=2;
omega=1;
us = y(1);
usy = y(2);
uo = y(3);
u0y = y(4);
thetas = y(5);
thetasy = y(6);
thetao = y(7);
thetaoy = y(8);
dydx = zeros(8,1);
switch region
case 1 % x in [-1 0]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k2)*us – alpha*Ps*R2;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R2)*uo – alpha*Po*R2; % 1/K2 ?
dydx(5) = thetasy+thetas;
dydx(6) = k1*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k3*thetasy*thetaoy;
case 2 % x in [0 1]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k1)*us – Ps*R1;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R1)*uo – Po*R1;
dydx(5) = thetasy;
dydx(6) = k2*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k4*thetasy*thetaoy;
end
end
function res = bc(YL,YR)
mu1=1; mu2=1; k1=1; k2=1;
res = [YL(1,1)
YL(3,1)
YL(5,1)
YL(7,1)
YR(1,2)-1
YR(3,2)-1
YR(5,2)-1
YR(7,2)
YR(1,1)-YL(1,2)
mu1*YR(2,1)-mu2*YL(2,2)
YR(3,1)-YL(3,2)
mu1*YR(4,1)-mu2*YL(4,2)
YR(5,1)-YL(5,2)
k1*YR(6,1)-k2*YL(6,2)
YR(7,1)-YL(7,2)
k1*YR(8,1)-k2*YL(8,2)];
end
The graph relating to code is
But I need the -1 to 1 range on Y-axis like the following graph: graph MATLAB Answers — New Questions