MATLAB example not working.
조회 수: 3 (최근 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
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!