How do I multiply two functions handles?
Ältere Kommentare anzeigen
%%---------constants:
Gma_32 = 100
Gma = 210e-15
gamma_u = 500
gamma_c = 50
a = Gma_32/sqrt(2*gamma_u*Gma)
n = 4e10
c1 = -4
c2 = 2.05
c3 = 1
K = 10
%--------Function
%
% X = @(k) -4*n - a^2*n*sqrt(n) + 4*c1*k.^4 + (2*a*sqrt(n)-16*K^2 + 4*a*c1*c3*sqrt(n) + 8*n*c1*c2)*k.^2
% Sq = @(k) sqrt((-X(k) + sqrt(X(k).^2 + Y^2 ))/2)
% f = @(k) -2*k.^2 - 2*n - a*sqrt(n) + Sq(k)
% f2 = @(k) -2*k.^2 - 2*n - a*sqrt(n) - Sq(k)
%------------------------------Fns:
b_i = @(k) -4*c1*k*K
b_r = @(k) 2*k.^2 +2*n + a*sqrt(n)
c_i = @(k) ( 4*n*c2* - 2*(2*n + a*sqrt(n))*c1 + 2*a*sqrt(n)*c3 )*K*k
c_r = @(k) -(1 + c1^2)*k.^4 - (2*n -4*(1 + c1^2)*K^2 + sqrt(n)*c3*c1 + 2*n*c1*c2 )*k.^2
D_r = @(k) b_r(k).^2 - b_i(k).^2 -4*c_r(k)
D_i = @(k) 2*b_i(k).*b_r(k) - 4*c_i
f = @(k) -b_i(k) + sqrt( -D_r(k) + sqrt(D_i(k)^2 + D_r(k)^2))/4
%-------Grid:
k = -200:0.1:200
% %-------Plot
%
plot(k,f(k))
%plot(k,f2(k))
theres an error on line with function f, how do i multiply two functoin handles. or suggest a bwtter way of plotting this function.

1 Kommentar
Steven Lord
am 14 Jun. 2022
FYI for the future, when you're asking for help with code that throws an error message or issues a warning message please include the full and exact text of the error or warning message in your original question. This information may help readers determine the cause of the error and how to correct it more quickly. Thanks.
Akzeptierte Antwort
Weitere Antworten (1)
Tlotlo Oepeng
am 14 Jun. 2022
0 Stimmen
1 Kommentar
Star Strider
am 14 Jun. 2022
As always, my pleasure!
Kategorien
Mehr zu Polar Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
