I'd like to re-run my code each time for multiple variables. Yes, I know that I could use a for loop for this, but because my code is complex and has a long run time as is
it would be inefficient to use a for loop. So I would like to run the code for a parameter. Then, re-run the code again and draw over the current plot. However, every time I re-run the code instead of plotting the new data over the previous data I have new plots open up. I'm trying to compare how changing incident angle of a bragg reflector shifts the "filter" to the right for angles in the range of 0-60 degrees. So it's ideal that each run plots over the last run. Here is plot code so far.
%Plot the data on two seperate graphs.
figure()
subplot(2, 1, 1)
hold on
plot(range, ref_data_reflection_S)
title("Perpendicular Reflection Magnitude")
%xlabel("Incident wavelength (meters)")
ylabel("Perpendicular Reflection Magnitude")
subplot(2, 1, 2)
hold on
plot(range, ref_data_transmission_S)
title("Perpendicular Transmission Magnitude")
%xlabel("Incident wavelength (meters)")
ylabel("Perpendicular Transmission Magnitude")