# differentiation in matlab of two functions

45 views (last 30 days)
Murali Krishna AG on 3 Dec 2020
Commented: Stephan on 4 Dec 2020
Let
theta=atan(p/q)+pi
a(theta)=exp(2*pi*j*A*[cos(theta);sin(theta)]) where A ,is row vector and p,q,A are known

Alan Stevens on 3 Dec 2020
a = @(theta) exp(2j*pi*A*[cos(theta);sin(theta)]);

Stephan on 3 Dec 2020
syms a(theta) p q A
eq1 = a(theta)==exp(2*pi*1i*A*[cos(theta);sin(theta)])
eq2 = theta==atan(p/q)+pi
Deq1 = diff(eq1,theta)
sol = subs(rhs(Deq1),theta,rhs(eq2))
pretty(sol)

Stephan on 4 Dec 2020
syms A1 A2 p q
sol = -exp(- (A1*pi*2i)/(p^2/q^2 + 1)^(1/2) - (A2*p*pi*2i)/...
(q*(p^2/q^2 + 1)^(1/2)))*((A2*pi*2i)/(p^2/q^2 + 1)^(1/2) -...
(A1*p*pi*2i)/(q*(p^2/q^2 + 1)^(1/2)));
Amat = [0.5 2.5];
porg = 3;
qorg = -1;
sol_new = subs(sol, [A, p, q], [Amat, porg, qorg])
num_result = vpa(sol_new)
gives:
sol_new =
-(10^(1/2)*pi*exp((pi*10^(1/2)*7i)/5)*4i)/5
num_result =
7.7406505609803157366313776809726 - 1.8021645484713704266844120210115i
Murali Krishna AG on 4 Dec 2020
Thank u so much,It helped me a lot
Stephan on 4 Dec 2020
Did you notice that you can accept and/or vote for useful answers?