MATLAB example not working.

6 次查看(过去 30 天)
Hi,
I am running code for plotting beam pattern by following webpage of MATLAB: https://in.mathworks.com/help/phased/examples/introduction-to-hybrid-beamforming.html
But MATLAB throws error:
"Undefined function 'scatteringchanmtx' for input arguments of type 'double'."
This code is provided by MATLAB team and still is not working. Your help will be highly appreciated. Code is provided below:
clc, clear all
Nt = 64;
NtRF = 4;
Nr = 16;
NrRF = 4;
rng(4096);
c = 3e8;
fc = 28e9;
lambda = c/fc;
txarray = phased.PartitionedArray(...
'Array',phased.URA([sqrt(Nt) sqrt(Nt)],lambda/2),...
'SubarraySelection',ones(NtRF,Nt),'SubarraySteering','None');
rxarray = phased.PartitionedArray(...
'Array',phased.URA([sqrt(Nr) sqrt(Nr)],lambda/2),...
'SubarraySelection',ones(NrRF,Nr),'SubarraySteering','None');
Ncl = 6;
Nray = 8;
Nscatter = Nray*Ncl;
angspread = 5;
% compute randomly placed scatterer clusters
txclang = [rand(1,Ncl)*120-60;rand(1,Ncl)*60-30];
rxclang = [rand(1,Ncl)*120-60;rand(1,Ncl)*60-30];
txang = zeros(2,Nscatter);
rxang = zeros(2,Nscatter);
% compute the rays within each cluster
for m = 1:Ncl
txang(:,(m-1)*Nray+(1:Nray)) = randn(2,Nray)*sqrt(angspread)+txclang(:,m);
rxang(:,(m-1)*Nray+(1:Nray)) = randn(2,Nray)*sqrt(angspread)+rxclang(:,m);
end
g = (randn(1,Nscatter)+1i*randn(1,Nscatter))/sqrt(Nscatter);
txpos = getElementPosition(txarray)/lambda;
rxpos = getElementPosition(rxarray)/lambda;
H = scatteringchanmtx(txpos,rxpos,txang,rxang,g);
F = diagbfweights(H);
F = F(1:NtRF,:);
pattern(txarray,fc,-90:90,-90:90,'Type','efield',...
'ElementWeights',F','PropagationSpeed',c);
  2 个评论
Voss
Voss 2020-7-7
Do you have the Phased Array System Toolbox installed?

请先登录,再进行评论。

采纳的回答

Stephen23
Stephen23 2020-7-8
编辑:Stephen23 2020-7-8
Typical reasons why that function might not work:
  • scatteringchanmtx was introduced in R2017b. It will not work with earlier MATLAB versions. You did not tag the question with the MATLAB version you are using, but it helps us when you do.
  • the toolbox is not installed (check using ver).
  • the toolbox is not licensed (check https://www.mathworks.com/licensecenter).
  • the Search path has been changed so the function cannot be found.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by