I did not got the required result??? error!!!
Mostra commenti meno recenti

my programme is not upto mark,where i doing mistake help me little.thank you
4 Commenti
I am not able to edit this question. Maybe the image is too huge. Please shrink and rotate it to improve the readability. Posting code directly is useful also:
D = 15;
tmpI = eye(D);
%sum of ket1 to ket14 is
%generalised this line of code for any value of D
ket = sum(tmpI(:,2:D),2);
syms n
ct = 6;
creation = circshift(diag(sqrt(0:1:(D-1))),-1);
annihilation = creation';
%pre-allocation
%[ketalpha, V, Vnorm] = deal(cell(1,ct));
Vnorm = zeros(1,ct);
alpha = 0.03*(1:ct);
%loop for calculation
for k = 1:ct
temp0 = symsum(exp(-abs(alpha(k))^2 * alpha(k)^n / sqrt(factorial(n)) ), n, 0, 14)*ket;
%ketalpha{k} = temp0;
temp1 = annihilation*temp0 - alpha(k)*temp0;
%V{k} = temp1;
Vnorm(k) = temp1'*temp1;
end
plot(alpha,Vnorm, '-*k')
xlim([0 0.21])
xlabel('alpha', 'Color', 'b', 'FontSize', 15)
ylabel('Vnorm', 'Color', 'b', 'FontSize', 15)
It runs without an error. I you do get an error, post a copy of the complete message.
Abu Zar
il 21 Feb 2023
Abu Zar
il 21 Feb 2023
Risposte (0)
Categorie
Scopri di più su Quantum Computing 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!
