View Single Post
Mark44
#13
Nov4-09, 04:09 PM
Mentor
P: 21,214
Your for loop should run from 1 to 150. That will give your gamma values .01, .02, ..., 1.49, 1.50.

You are using matrix arithmetic operations such as .* and ./ in a number of places that aren't needed. The following are examples of this
C11 = x.*C11_InAs + (1-x).*C11_GaAs;
V = C12./(C11+C12);
a = x.*a_InAs + (1-x).*a_GaAs;

b = a./sqrt(2);
alpha = pi./3;
lambda = pi./3;

These are probably not causing any problems, but might be something to think about.

Since I don't have matlab (and have never used it), I am not able to run your script. I don't see anything obviously wrong with it, but I would do the following.

1. Temporarily change the for loop to for i=1:2. You want the loop to run just a couple of times so you can see the values produced by final_result(1) and final_result(2). These are apparently coming out as 0.
2. Take all the final semicolons off the statements in the for loop (including the inner while loop) so that you can see the output.
3. Run your script.

Alternatively, you can hand-simulate the execution of the for loop (which is likely where the problem lies), by starting with i = 1, and hand calculating hc_new and going through the while loop to see what happens. It should be that after the while loop exits, final_result(1) gets set to a nonzero value.

Hope that helps.