%% Lecture 3 %page 13 hfig = hgload('Name.fig') % load Name.fig in Folder figure(hfig); % visualization haxe=get(hfig,'Children') %Graphs! % haxe contains single line–the same approach for multiple lines ChAxes=get(haxe,'Children')% line finding! x=get(ChAxes{2},'XData'); % X-coordinates of line y=get(ChAxes{2},'YData'); % Y-coordinates of line figure, plot(x,y) % check line! title('name.fig graph reconstruction ') %% Lecture3 p14 figure subplot(1,2,2) f = @(x,n) exp(sin(n*x))*cos(x); fplot(@(x)f(x,10),[0 2*pi],'r','linewidth',1.5) % % Vector or element-by-element operations: subplot(1,2,1) f = @(x,n) exp(sin(n*x)).*cos(x).*sin(x); fplot(@(x)f(x,10),[0 2*pi],'r','linewidth',1.5) title('vectorized') %% Lecture3 p 15 %% ezplot; fplot -for new versions!!! figure r=ezplot('x^2+(y-abs(x)^(1/2))^2=1'), hold on, grid on set(r,'linewidth',3,'color','red' ); title(' ') % the line of the first function with a descriptor is automatically placed in the header r title(' ') rf=ezplot('x^2+(y-1)^2=4',[-3,3]) ; title(' ') ra=ezplot(@(x,y) y^3+x^2-4); set(ra,'linewidth',2.5,'color','cyan' ); title(' '); legend('x^2+(y-abs(x)^{(1/2)})^2=1',... 'x^2+(y-1)^2=4','y^3+x^2-4=0') %% implicitplot -(New!!!) % For function f(x,y) = 0 figure fp = fimplicit(@(x,y) x.^2+ y.^2 -3) fp.LineWidth =3 % Important fp.Color=[0.7 0 0.3] % Register! title('x^2 + y^2 -3=0','fontsize',14) axis square % !!!!!!!!!!!!! clear %% Page 16 I. Extreme points are added: x = linspace(-2,3); % 100 point -default y = 3*x.^3-6*x.^2; % vectorized! plot(x,y,'c-','linewidth',1.5) %the simplest way % The inscription about the zero derivative is set by evaluating visually: xt = [-0.2 1.5]; yt = [5 -7];str = 'dy/dx = 0'; text(xt,yt,str,'fontsize',12), hold on % may be will add something?! % II.TEXT. Conditions forminandmax: % yim1yip1 yim1>yi,yiyip1) %max condition indexmax=find(trmax) trmin=and(yim1>yi,yi