MATLAB example not working.
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Stephen23
le 8 Juil 2020
Modifié(e) : Stephen23
le 8 Juil 2020
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!