I have a code that computes different values for variable "component" in each iteration of a for loop and then plots this variable in subplot(3,1,1). With each click/button press I get a new curve added to subplot(3,1,1). I want the last curve that was plotted to stand out by having a thicker LineWidth.
clear all
fs = 10000;
t = 0 : 1/fs : 1;
component = 0;
sig = 0;
N = 10;
for i = 1:N
f(i) = 2^(i-1);
waitforbuttonpress
component = (100/i)*sin(2*pi*f(i)*t);
sig = component + sig;
subplot(3,1,1)
plot(t, component, 'color', rand(1,3), 'LineWidth', 2)
hold on
subplot(3,1,2)
plot(t,sig, 'LineWidth', 2)
end
close
clear all
For example, if I already have 4 curves on subplot(3,1,1), each having LineWidth = 0.5 and I press a button, the 5th curve must be added with LineWidth = 2. With the next button press, the 5th curve must change to LineWidth = 0.5 (same as the curves that came before it) and the 6th curve must have LineWidth = 2. This way the most recent curve will stand out.
Any ideas?