I'm trying to write a For loop for when KE (Subplot #1) is equal to PE (Subplot #2) and label it as an asterisk. Below is part of my main script and attached is a picture of the graph.
for n = 1:7 figure(2); KE{n} = 0.5*m*(U{n}.^2 + V{n}.^2 + W{n}.^2 ); PE{n} = m*g*Z{n} ; hold on subplot(2,1,1); plot(T{n},KE{n},color(n)); subplot(2,1,2); plot(T{n},PE{n},color(n))
My attempt. I tried setting a For Loop for each line, such that when KE = PE, Matlab wouldd label the point as an asterick for both plots.
for n = 1:7 if KE{n}==PE{n} subplot(2,1,1) plot(KE{n}==PE{n},['*' color(n)]); hold on subplot(2,1,2) plot(PE{n}==KE{n},['*' color(n)]);end
Best Answer