plot the equation graph

how to plot graph V vs x
equation is
V*sqrt(1-x)=m*pi+atan((x)/(1-x))+atan((a+x)/(1-x))
taking V=1:10
m=0
a=1;
then plot V vs x

3 comentarios

Wan Ji
Wan Ji el 30 de Ag. de 2021
It's your homework, not our duty to help you. Your words are impolite and made me uncomfortable. I delelted the code that I wrote. Looking back to the questions you've asked, you are lacking in basic respect and gratefulness to others who have helped you. Hope you behave yourself better
shiv gaur
shiv gaur el 30 de Ag. de 2021
sorry for inconviniennce but graph is not showing exact value on page 63 fig 3.14 for a=10 the answer is not showing as shown in fig equation 3,44 sorry again for again

Iniciar sesión para comentar.

Respuestas (1)

Wan Ji
Wan Ji el 30 de Ag. de 2021

0 votos

Hi,
It is not neccessary to solve this equation
x = 0:0.00001:1;
f = @(x,m,a)(m*pi+atan((x)/(1-x))+atan((a+x)/(1-x)))./sqrt(1-x);
m = [0,1,2];
a = [0,10,1e15];
V1 = f(x,m(1),a(1));
V2 = f(x,m(1),a(2));
V3 = f(x,m(1),a(3));
plot(V1,x)
hold on
plot(V2,x)
plot(V3,x)
V1 = f(x,m(2),a(1));
V2 = f(x,m(2),a(2));
V3 = f(x,m(2),a(3));
plot(V1,x)
hold on
plot(V2,x)
plot(V3,x)
V1 = f(x,m(3),a(1));
V2 = f(x,m(3),a(2));
V3 = f(x,m(3),a(3));
plot(V1,x)
hold on
plot(V2,x)
h = plot(V3,x);
axis([0, 15, 0, 1.1])
grid on

8 comentarios

shiv gaur
shiv gaur el 30 de Ag. de 2021
graph is fine and matching with fig but sir you have assume the value of x this equation is transcedental equation so you have to required some other method so that find the root of the equation satisfy the equation by varying the value of V suppose 1:10 so 10 value of x can find so these 10 value of V and 10 value of x gives the graph so sir we an use numerical method
shiv gaur
shiv gaur el 30 de Ag. de 2021
plot n vs x n vs y
for n=1:10
[t,r]=ode45(@fn,[0 140],[0.01+n 0.01 ])
plot (n,r(:,1))
end
function dr=fn(t,r)
x=r(1); y=r(2);
dr=zeros(2,1)
dr(1)=x+y;
dr(2)=x-y;
end
shiv gaur
shiv gaur el 30 de Ag. de 2021
using array index
Wan Ji
Wan Ji el 30 de Ag. de 2021
Editada: Wan Ji el 30 de Ag. de 2021
Is this the right way to access x when V = 0:10?
the main function
function main
mu = 0;
a = 1;
V_arr = 0:1:15;
[V_arr, X_arr] = getX(V_arr,mu(1),a(1));
plot(V_arr, X_arr,'rs-','markerfacecolor','r','markersize',10);
axis([0 15 -0.5 1])
end
function [V_arr, xnorm] = getX(V_arr,mu,a)
f = @(V,x,m,a)V*sqrt(1-x)-(m*pi+atan((x)/(1-x))+atan((a+x)/(1-x)));
m = mu;
a = a;
x0=-0.999;
x1=0;
x2=0.999;
TOL=1e-14;
Nmax=1000;
% V_arr = 0:1:15;
X_arr = zeros(size(V_arr));
for i = 1:1:numel(V_arr)
V = V_arr(i);
X_arr(i) = muller(@(x)f(V,x,m,a), x0, x1, x2, TOL, Nmax);
% X_arr(i) = real(fsolve(@(x)f(V,x,m,a), 0.8));
end
% xnorm = (X_arr-min(X_arr))/(max(X_arr)-min(X_arr));
xnorm = X_arr;
end
Muller method
function X = muller(f, x0, x1, x2, TOL, Nmax)
for n=1:Nmax
h1=x1-x0;
h2=x2-x1;
d1=(f(x1)-f(x0))/h1;
d2=(f(x2)-f(x1))/h2;
a=(d1-d2)/(h2+h1);
b=d2+h2*a;
c=f(x2);
t=x2-(2*c*sign(b))/(abs(b)+sqrt(b^2-4*a*c));
s=f(t);
if abs(s)<TOL
break
else
x0=x1;
x1=x2;
x2=t;
end
end
X = real(t);
end
shiv gaur
shiv gaur el 30 de Ag. de 2021
sir muller method giving right value test program for x^2+1 but it is showing only one root
shiv gaur
shiv gaur el 30 de Ag. de 2021
sir muller method giving right value test program for x^2+1 but it is showing only one root
Wan Ji
Wan Ji el 30 de Ag. de 2021
you can change x0,x1 and x2 to get more roots if there are
shiv gaur
shiv gaur el 25 de Sept. de 2021
Mj=[cos (kj hj) i*sin(kj hj) /kj ; i*kj*sin(kj hj) cos (kj hj) ];
kj=sqrt(nj2*k02-x2);
Take n1=1.521;n2=2.66;k0=1;h1=1.5e-6;h2=1e-6
We take M=M1*M2;
Where M=( m11 m12;m21 m22) as usual in
Matrix;
How to multiply this matrix for M find the multiplication of matrix and find the value of
x;
and solve the eq
ns=1.512;
nc=1.2-i7;
gs=x2-ns2k02;
gc= x2-ns2k02;
f(x)=igsm11+gcm22)-m21+gsgcm12;
and solve the eq and value of x

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Etiquetas

Preguntada:

el 30 de Ag. de 2021

Comentada:

el 25 de Sept. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by