P=100:5:500; n=length(P); for i=1:n J(i)=P(i)*P(i)-500*P(i)+1000000; end Hasil=[P' J'] plot(P,J), grid on