Question: showing Loop Substitution Error and need help in Plotting the Results

I am working on a script (attached sheet) where I use a FOR loop to iterate over different values of varepsilon. Within each iteration, I perform the following steps:

  1. I optimize the function R_out and obtain a result, denoted as Pc

  2. I then substitute Pc into another function, L_out and optimize it to find the values of p1,p2, and the corresponding function value.

I follow a similar procedure for a second case as well.

However, I'm encountering an issue: I'm unable to successfully substitute the result from R_out into L_out within the loop. This is causing an error in execution.

Finally, I intend to generate a plot with varepsilon  on the x-axis and certain result variables on the y-axis in a single plot (as indicated at the end of the sheet).

Sheet: Question_New.mw

Can someone help me:

  1. Fix the substitution error in the loop, and

  2. Provide the correct syntax for generating the desired plot?

Please Wait...