Effacer les filtres
Effacer les filtres

what is the error? Example?

1 vue (au cours des 30 derniers jours)
Idrees Muhammad
Idrees Muhammad le 9 Fév 2023
Commenté : Walter Roberson le 10 Fév 2023
% ket Transforms a vector into normalized column vector.
function w=ket(;5)
if x>1,
end % if
% normalisation
function Q = bra_ket(Psi,Phi,f_op)
Q = integral3(@(r1,r2,r3) Psi(r1,r2,r3).*f_op(Phi(r1,r2,r3)),r1min,r1max,r2min,r2max,r3min,r3max)
function Q = bra_ket_traps(Psi,Phi,f_op,r1,r2,r3)
opPhi = f_op(Phi,r1,r2,r3); % Here you might need additional argument
Q = trapz(r3(1,1,:),trapz(r2(1,:,1),trapz(r1(:,:,1),conj(Psi).*(opPhi)),2),3);
% cohstate cohstate(alpha,M) gives the state vector of M elements for
% a coherent state with given alpha
function v=cohstate(alpha,M)
for n=0:M-2
end % for

Réponses (2)

Luca Ferro
Luca Ferro le 9 Fév 2023
there is a ';' in the function call on line 1: function w=ket(;5)
  1 commentaire
Idrees Muhammad
Idrees Muhammad le 10 Fév 2023
hi,please give me one example.

Connectez-vous pour commenter.

Voss le 9 Fév 2023
Invalid syntax:
function w=ket(;5)
Inside the parentheses in a function definition should be a list of variable names. ";5" is not a list of variable names.
Maybe you meant:
function w=ket(v)
  11 commentaires
Idrees Muhammad
Idrees Muhammad le 10 Fév 2023
i mean that how i put the numeric values for "alpha" and "m" to get the results of thie cohstate
Walter Roberson
Walter Roberson le 10 Fév 2023
If you are using the option on the green Run button to have it prompt you for the parameter values then OK, go ahead and do that. Personally I find doing that to be slow and not to offer me fine enough control for my purposes, but if that is what you want to do, go ahead and get back to us if you encounter further errors in your code.
Personally I use the techniques I described earlier https://www.mathworks.com/matlabcentral/answers/1909685-what-is-the-error-example#comment_2608885

Connectez-vous pour commenter.


En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by