clearclc;N=2000; % Number of time stpes
dt=0.05; %Time step
%Initialize
y=zeros(N,1); t=zeros(N,1);%Initial values
t(1)=0;y(1)=1; for j=2:N t(j)=t(j-1)+dt; y(j)=y(j-1)+dt*sin(t(j-1)); end plot(t,y)
MATLAB: I want to find particular values of t at which y becomes 2 (by writing some commands in code itself). Can I extract such values of t as a vector
finding input value corresponding to some value of output in 1d equation.
Best Answer