Mexican Hat function plot help
Mostra commenti meno recenti
Hello all,
I'm trying to plot a certain Mexican Hat function (other than the one they provide in MATLAB), but I'm getting the matrix dimensions must agree when I define psi. I tried everything to fix the code, but no luck. Can someone advise?
I know some code is repetitive, but I need them in other areas of my code.
dXs = 1;
x = [-20,20];
SamplingScale = [1, dXs, 4, 20 ,40];
Range = SamplingScale;
HalfRange = Range/2;
Sigma = HalfRange/4;
SigmaSq = Sigma.^2;
for i = 1:length(x)
psi = (2/(sqrt(3)*Sigma)*pi^(-0.25))*(1-(i^2/Sigma^2))*(e^(-i^2/2*SigmaSq));
end
plot (psi)
Thanks again!
Risposta accettata
Più risposte (1)
Palguna Gopireddy
il 31 Mar 2022
0 voti
What is the mexihat equation used in matlab. In original equation there is no term called [lb,ub].
3 Commenti
Ramiro Saldaña Acosta
il 8 Apr 2022
x=linspace(lb,ub,N)
y=(2/(sqrt(3)*pi^0.25)) * exp(-x.^2/2) .* (1-x.^2);
you define lb,ub and N in this code
Ramiro Saldaña Acosta
il 8 Apr 2022
I suggest lb=-5, ub=5, N=50
Palguna Gopireddy
il 8 Apr 2022
Thanks.Got it.any function can be know seen by pressing right click on it and opening it.
But for chebwin function one of the lines is 'chebwinx' which can't be opened. They said it is a MEX file. Do you know any way to open and see a MEX file in matlab.
Categorie
Scopri di più su Parallel for-Loops (parfor) in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!