Unrecognized function or variable 'quad8'

4 次查看(过去 30 天)
Greetings,
Currenlty working on a project for a radar class I am taking and I keep getting an error for Unrecognized function or variable 'quad8'. As far as I know quad is supposed to numerciallly evaluate an integral. I tried using quall and intgeral instead but keep getting an error. I am basically troubleshooting this entire code which is lengthy and I can certainly use some advice. The end result is a Power Spectral Density plot and a isodop footprint plot which is describing a radar travelling horizontally with a narrow beam antenna squinted at 45 degrees.I attached pics of what plots should look like. I am including the code here.Thank you in advance for any help you may offer!
clear all;
close;
format long;
global r;
%
%Setup of the parameters
%
u=7.5e+3; %speed of the plane
alpha0=2.5*pi/180; %beam depth in radians
alpha_lim=1.5*alpha0; %limit angle for integration
phi=45*pi/180; %squinted angkle in radiians
theta=30*pi/180; %vertial plotting anglein radians
%Finding the limit in the integration
%path in terms of relative Doppler frequency
%
c = cos(alpha_lim);
s = sin(alpha_lim);
fu = (8*c*c-7)/(-2*sqrt(14)*s+2*sqrt(2)*c)
fl = (8*c*c-7)/(2*sqrt(14)*s+2*sqrt(2)*c)
%
% Computing the power spectral density(psd)
%
fd = linspace(fu,fl,502); % rrelative Doppler frequency
fr = 1./fd; % fr parameter
Num = length(fr);
psd = zeros(1,Num-2); % We exclude the boundary points
% in the psd
footprint_u = zeros(1,Num-2);
footprint_l = zeros(1,Num-2);
footprint_f = zeros(1,Num-2);
for n = 2:Num-1,
r = fr(n);
t1 = sqrt(r*r-1);
t2 = sqrt(7*(r*r-1)-(1-2*sqrt(2)*c*r)^2);
t3 = 1+t1-2*sqrt(2)*c*r;
su = (-sqrt(6)*t1-t2)/t3;
sl = (-sqrt(6)*t1+t2)/t3;
uu = log(su);
ul = log(sl);
footprint_u(n-1) = uu;
footprint_l(n-1) = ul;
footprint_f(n-1) = r;
psd(n-1) = quad8('f_int',ul,uu)/(sqrt(1-1/r/r))^3;
end
psd= psd/max(psd);
fd_plot = fd(2:Num-1);
plot(fd_plot,psd);
%semilogy(fd_plot,psd);
hold on
x_fl=[fd(1) fd(1)];
y_fl=[0 1];
plot(x_fl,y_fl,'k')
%semilogy(x_fl,y_fl,'k')
x_fu=[fd(Num) fd(Num)];
y_fu=[0 1];
plot(x_fu,y_fu,'k')
%semilogy(x_fu,y_fu,'k')
title('Fading Spectrum')
xlabel('f_{D}/f_{D_{0}}')
ylabel('PSD/PSD_{0}')
text(0.281,.5,'lowest f_{d}/f_{d_{0}}=0.292');
text(0.385,.5,'highest f_{d}/f_{d_{0}}=0.414');
%
% generating the Limit Isodops and
% The footprint
%
figure(2)
u_hyp=linspace(0,1,100);
x_hyp_low=cosh(u_hyp)./(sqrt((1/fu)^2-1));
y_hyp_low_sinh(u_hyp);
plot(x_hyp_low,y_hyp_low,'k--')
hold on;
x_hyp_up=cosh(u_hyp)./(sqrt((1/fl)^2-1));
y_hyp_up=sinh(u_hyp);
plot(x_hyp_up,y_hyp_up,'k--')
% The footprint
% Those point belong to thte isodops
% and for those points u=uu or ul
%
u_footprint = zeros(1,2*Num-4);
f_footprint = zeros(1,2*Num-4);
for n = 1:Num-2,
u_footprint1(n)=footprint_u(n);
u_footprint2(n)=footprint_1(n);
f_footprint1(n)=footprint_f(n);
f_footprint2(n)=footprint_f(n);
end
x_footprint1=cosh(u_footprint1)./(sqrt((f_footprint1).^2-1));
y_footprint1=sinh(u_footprint1);
plot(x_footprint1,y_footprint1);
x_footprint2=cosh(u_footprint2)./(sqrt((f_footprint2).^2-1));
y_footprint2=sinh(u_footprint2);
plot(x_footprint2,y_footprint2);
axis equal;
set(gca, 'xlim', [0 0.8], 'ylim', [0 0.8])
title('Footprint')
xlabel('X=x/h')
ylabel('Y=y/h')
grid on
text(0.25, 0.1, 'f_{d}/f_{d}_{0}=0.292')
text(0.5, 0.7, 'f_{d}/f_{d}_{0}=0.414')
%
% This is the integrand for the psd
%
function y = f_int(x)
global r
s = exp(x);
rterm = sqrt(r*r-1);
alpha0 = 2.5*pi/180;
alpha = acos(((1+rterm)*s.*s+2*sqrt(6)*rterm*s+(1-rterm))./ ...
(2*sqrt(2)*r*(s.*s+1)));
y = (cosh(x).^2-1/r/r).*exp(-2*alpha.*alpha/alpha0/alpha0);
end

采纳的回答

Jose Iglesias
Jose Iglesias 2022-2-13
Thank you tremendously for all your guidance!!
  1 个评论
Voss
Voss 2022-2-13
编辑:Voss 2022-2-13
No problem! How about you do me a favor and unaccept your answer and accept mine? I appreciate it!

请先登录,再进行评论。

更多回答(1 个)

Voss
Voss 2022-2-12
编辑:Voss 2022-2-12
As mentioned in the answer here (with plenty of reference links in it):
quad8() has been removed and replaced by quadl(), which was then replaced by integral().
Changing quad8 to integral and changing the first argument to a function handle - and fixing a couple of typos - seems to have gotten the code to run:
clear all;
close;
format long;
global r;
%
%Setup of the parameters
%
u=7.5e+3; %speed of the plane
alpha0=2.5*pi/180; %beam depth in radians
alpha_lim=1.5*alpha0; %limit angle for integration
phi=45*pi/180; %squinted angkle in radiians
theta=30*pi/180; %vertial plotting anglein radians
%Finding the limit in the integration
%path in terms of relative Doppler frequency
%
c = cos(alpha_lim);
s = sin(alpha_lim);
fu = (8*c*c-7)/(-2*sqrt(14)*s+2*sqrt(2)*c)
fu =
0.413975431045285
fl = (8*c*c-7)/(2*sqrt(14)*s+2*sqrt(2)*c)
fl =
0.291617380244238
%
% Computing the power spectral density(psd)
%
fd = linspace(fu,fl,502); % rrelative Doppler frequency
fr = 1./fd; % fr parameter
Num = length(fr);
psd = zeros(1,Num-2); % We exclude the boundary points
% in the psd
footprint_u = zeros(1,Num-2);
footprint_l = zeros(1,Num-2);
footprint_f = zeros(1,Num-2);
for n = 2:Num-1,
r = fr(n);
t1 = sqrt(r*r-1);
t2 = sqrt(7*(r*r-1)-(1-2*sqrt(2)*c*r)^2);
t3 = 1+t1-2*sqrt(2)*c*r;
su = (-sqrt(6)*t1-t2)/t3;
sl = (-sqrt(6)*t1+t2)/t3;
uu = log(su);
ul = log(sl);
footprint_u(n-1) = uu;
footprint_l(n-1) = ul;
footprint_f(n-1) = r;
% psd(n-1) = quad8('f_int',ul,uu)/(sqrt(1-1/r/r))^3;
psd(n-1) = integral(@f_int,ul,uu)/(sqrt(1-1/r/r))^3;
end
psd= psd/max(psd);
fd_plot = fd(2:Num-1);
plot(fd_plot,psd);
%semilogy(fd_plot,psd);
hold on
x_fl=[fd(1) fd(1)];
y_fl=[0 1];
plot(x_fl,y_fl,'k')
%semilogy(x_fl,y_fl,'k')
x_fu=[fd(Num) fd(Num)];
y_fu=[0 1];
plot(x_fu,y_fu,'k')
%semilogy(x_fu,y_fu,'k')
title('Fading Spectrum')
xlabel('f_{D}/f_{D_{0}}')
ylabel('PSD/PSD_{0}')
text(0.281,.5,'lowest f_{d}/f_{d_{0}}=0.292');
text(0.385,.5,'highest f_{d}/f_{d_{0}}=0.414');
%
% generating the Limit Isodops and
% The footprint
%
figure(2)
u_hyp=linspace(0,1,100);
x_hyp_low=cosh(u_hyp)./(sqrt((1/fu)^2-1));
% y_hyp_low_sinh(u_hyp);
y_hyp_low=sinh(u_hyp); % possible typo corrected
plot(x_hyp_low,y_hyp_low,'k--')
hold on;
x_hyp_up=cosh(u_hyp)./(sqrt((1/fl)^2-1));
y_hyp_up=sinh(u_hyp);
plot(x_hyp_up,y_hyp_up,'k--')
% The footprint
% Those point belong to thte isodops
% and for those points u=uu or ul
%
u_footprint = zeros(1,2*Num-4);
f_footprint = zeros(1,2*Num-4);
for n = 1:Num-2,
u_footprint1(n)=footprint_u(n);
% u_footprint2(n)=footprint_1(n);
u_footprint2(n)=footprint_l(n); % possible typo corrected
f_footprint1(n)=footprint_f(n);
f_footprint2(n)=footprint_f(n);
end
x_footprint1=cosh(u_footprint1)./(sqrt((f_footprint1).^2-1));
y_footprint1=sinh(u_footprint1);
plot(x_footprint1,y_footprint1);
x_footprint2=cosh(u_footprint2)./(sqrt((f_footprint2).^2-1));
y_footprint2=sinh(u_footprint2);
plot(x_footprint2,y_footprint2);
axis equal;
set(gca, 'xlim', [0 0.8], 'ylim', [0 0.8])
title('Footprint')
xlabel('X=x/h')
ylabel('Y=y/h')
grid on
text(0.25, 0.1, 'f_{d}/f_{d}_{0}=0.292')
text(0.5, 0.7, 'f_{d}/f_{d}_{0}=0.414')
%
% This is the integrand for the psd
%
function y = f_int(x)
global r
s = exp(x);
rterm = sqrt(r*r-1);
alpha0 = 2.5*pi/180;
alpha = acos(((1+rterm)*s.*s+2*sqrt(6)*rterm*s+(1-rterm))./ ...
(2*sqrt(2)*r*(s.*s+1)));
y = (cosh(x).^2-1/r/r).*exp(-2*alpha.*alpha/alpha0/alpha0);
end
  8 个评论
Voss
Voss 2022-2-13
You could also edit your path so it doesn't include that directory.
Jose Iglesias
Jose Iglesias 2022-2-16
Thank you for all your help. I renamed the file and it works.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by