Hello. I would like to display the max(abs(sigma)) from around t=7 to t=10 from this code. The plot is from 0 to 10 and I tried to display that max value but it shows me the maximum value from the whole range (from 0 to 10) instead from 7 to 10. How can I do it? Here’s my code:
clear allt=0;% initial time
x=[1,1,1];% initial condition for t=0
alpha=30;tau=0.0001;k=1; % counter
while t<=10 f=-sin(t+5)-0.5*cos(t)-x(2); v=x(1); vc=sin(t+1)-cos(0.5*t-2); vcc=cos(t+1)+0.5*sin(0.5*t-2); sigma=v-vc; sigmadot=f-vcc; u=alpha*((abs(sigmadot)).^2*sign(sigmadot)+sigma)/((sigmadot).^2+abs(sigma)); dx=[f,cos(1+x(1)+x(3))+(2-cos(x(1)+x(3)+1))*u,cos(x(1)+0.5*x(3)-t)-x(3)+u]; x=x+dx*tau; t=t+tau; sigmav(k)=sigma; sigmadotv(k)=sigmadot; tv(k)=t; k=k+1;endfigureplot(tv,sigmav,'b',tv,sigmadotv,'r')
Help is appreciated!
Best Answer