If I use this piece of code
b=24; k=2000*3600; t=0:1:720;Q_y = zeros(size(t));for i = 1:length(t) if t(i) < 360-b/2 Q_y(i) = (k/(360-b/2))*t(i); elseif t(i) >= 360-b/2 && t(i) < 360+b/2 Q_y(i) = k; else Q_y(i) = (-k/(360-b/2))*t(i)+720*(k/(360-b/2)); endend
on itself everything is fine, but when I try to use it in a bigger piece of code Q_y suddenly gets imaginary values. Where do they come from and what can I do about them?
Best Answer