Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Function 9 3 Save 0' Reset E MATLAB Documentation 1 % Note that we count n from 0, but Matlab counts the elements of a
Function 9 3 Save 0' Reset E MATLAB Documentation 1 % Note that we count n from 0, but Matlab counts the elements of a vector from 1 2 function c = QHO_Coef(n) 3 c = zeros(1,n+1); 9.; an initial vector of zeros of a length n+1 (as it has to include the 0th coefficient) 4 if n == 0 % if n = 0, then just a simple vector of one number 5 c(1) = 1: 6 return 7 end 8 if mod(n,2) == 1 % if N is odd, c(1) = 0 and c(2) = 1 9 c(1) = 10 95... 11 else % n even then c(1) = 1 and c(2) = 0 12 %... 13 %... 14 end 15 epsilon = 2*n+1; 16 for j = 0:n2 17 c(j+2+1) = 18 end 19 end Matlab Task Set P3.1 Part 3.1 My Solutions > Implement a function computing a vector of coefficients for the n'\" state of the Quantum Harmonic Oscillator, using the recursive formula below: 2'- +1 cj+2 =C'm' where e: 2n+ l(e.g. e=5,15.71 for n =2,7,35). starting with initial conditions 50 = 1 and c1 = 0 for cases when n is even, or or CO = 0 and c1 = 1 when n odd. Code to call your function ? C Reset 1 QHO_Coef (6) Run Function ? Assessment: Submit ? The output of the function QHO_Coef is correct
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started