接上一篇的Matlab模拟结果,本篇提供5个Matlab程序:依次为:

(1)利用极坐标画图的函数:Generalcircle(varargin);

(2)图形(axis)在窗口(figure)中调整到最大化的位置(保留坐标轴Title和TabelTicks)函数:kieron_taylor(varargin);

(3)第一篇前14张图片对应的Matlab程序:envo_r1.m

(4)15-23张图片对应的Matlab程序:envo_r1_v.m ;

(5)24-28张图片对应的Matlab程序:envo_r2.m ;

注意:envo_r1.m,envo_r1_v.m,envo_r2.m有两种调用方式:一种是在m-file窗口中直接运行,command窗口中将提示输入初始值后运行;另一种是在command窗口中直接输入文件名,如:调用envo_r1.m输入>>envo_r1,之后将提示输出初始值以运行。

(1)利用极坐标画图的函数:Generalcircle(varargin)

function

handle_circle=generalcircle(varargin)%圆方程一般式x^2+y^2+a1*x+a2*y+a3=0的作图函数

% use function h=generalcircle(varargin) refering to following

examples:

%1. h =generalcircle( a1 , a2 , a3

,'PropertyName1','PropertyValure1','PropertyName2','PropertyValure2',...)

% With above expression ,a cirle with handle name h and

PropertyValues subjected to PropertyName resetted....

% will be plotted in current axes. please make sure DATATYPE of a1 ,

a2 , a3

% is real before you run the func , same rule apply to the

following

% examples;

%2.h= gernalcircle(a1, a2 ,a3)

% With this expression programming ,a cirle with handle name h and

DefaultPropertyValues subjected to PropertyName....

% will be plotted in current axes. error(nargchk(3,inf,nargin,'struct'));

if

~isreal(varargin{1})||~isreal(varargin{2})||~isreal(varargin{3})

error('Generalcircle:InvalidDatatypeofInputs',...

'Arguements:No.1-3 is Invalid!');

end

[cax,args,nargs] =

axescheck(varargin{:});

a=args(1:3);

delta=a{1}^2/4+a{2}^2/4-a{3};

if delta<0

error('Generalcircle:NonXYPlot','Paraments ( %d ,%d ,%d ) are

useless ,the circle does not exist.',varargin{1:3})

else

r=sqrt(delta);

alpha=linspace(0,2*pi,301);

x=zeros(numel(alpha));y=zeros(numel(alpha));

x=

-a{1}/2+r*cos(alpha);

y=

-a{2}/2+r*sin(alpha);

cax=newplot(cax);

if nargs

> 3

pvpairs=varargin(4:end);

handle_circle=plot(x,y,pvpairs{:});

else

handle_circle=plot(x,y,'parent',cax);

end

axis(cax,'equal');

end

(2)图形(axis)在窗口(figure)中调整到最大化的位置(保留坐标轴Title和TabelTicks)函数:kieron_taylor(vafunction

h=kieron_taylor(varargin)function

h=kieron_taylor(varargin)%kieron_taylor

maximum axes area in the given figure window and contrast

%axes area change before and after kieron_taylor(...)

executed.

%please be srue the right arguements fit the following cases so as

to

%meet expected requirements.

%

% kieron_taylor('Property1',PropertyValue1,'Property2',PropertyValue2)

% Property is A string featuring its

name.'kier'(Kier) or 'kieron'('Kieron')

% refer to maximum axes area options ,

accordingly, PropertyValue should

% be 0 or 1 ,1 means 'yes' to maximum axes area

option ,0 does the versus;

% 'tayl'('Tay') or 'taylor'('Taylor') means

contrast axes area change options,

% PropertyValue should be 0 or 1 ,1 means 'yes'

to contrast option ,0 does

% the versus;

%

% kieron_taylor( )

% default PropertyValues, 1 is relevant to

'Kieron',0 to 'Taylor';

%

% kieron_taylor(PropertyValue)

% PropertyValue is appointed to 'Kieron',0 to

'Taylor';

%

% kieron_taylor('Property1',PropertyValue1)

% PropertyValue2 is assigned as default;

%

% kieron_taylor(PropertyValue1,PropertyValue2)

% PropertyValues are corrspinding to 'Kieron' and

'Taylor';

%

% kieron_taylor('Property1',PropertyValue1,PropertyValue2)

% vice versa.

error(nargchk(0,4,nargin,'struct'));

kier=1; tayl=0;

switch nargin

case 0

case 1

kier=varargin{1};

case 2

if ischar(varargin{1})

eval_r( [

cell2mat(lower(regexpi(varargin{1},'^Kier|^Tayl','match'))),'=varargin{2}'

] );

else

kier=varargin{1}; tayl=varargin{2};

end

case 3

if strncmpi(varargin{1},'kier',4)

kier=varargin{2};tayl=varargin{3};

elseif strncmpi(varargin{1},'tayl',4)

kier=varargin{3}; tayl=varargin{2};

end

case 4

for i=1:2

eval_r( [

cell2mat(lower(regexpi(varargin{2*i-1},'^Kier|^Tayl','match'))),'=varargin{2*i}'

] );

end

end

if kier~=0&&kier ~=

1&&tayl~= 0&&tayl~= 1

error('kieron_taylor:InvalidDatatypeofInputs','ReshapeMark = %d ,

ContrastMark = %d , are both out of league.',...

kier ,tayl)

elseif kier~=0&&kier ~= 1

error('REshapeCAXOption:InvalidDatatypeofInputs','ReshapeMark = %d

,it is out of league.',kier)

elseif tayl~= 0&&tayl~=

1 error('REshapeCAXOption:InvalidDatatypeofInputs','ContrastMark = %d

,it is out of league.',tayl)

end

set(gcf,'color',[1,1,1]);

set(gca,'units','normalized','outerposition',[0,0,1,1]);

if tayl==0

ContrastReport='ContrastReport:

ContrastMark=0,不对比图像最大化效果!\n';

else

H=zeros(1,3);

H(1) =

annotation('rectangle', get(gca, 'Position'), 'Color',

'Blue');

H(2) =

annotation('rectangle', get(gca, 'Position') + ...

get(gca, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1],

...

'Color', 'Red','linewidth',3);

H(3) =

annotation('rectangle', get(gca, 'OuterPosition'), 'Color',

'Magenta','linewidth',3);

ContrastReport='ContrastReport: ContrastMark=1,对比图像最大化效果!\n';

end

if kier==0

REshapeReport='REshapeReport: ReshapeWark=0,不执行图像最大化!\n';

else

Tins=get(gca,'TightInset');

Htins=max(Tins(1),Tins(3));Vtins=max(Tins(2),Tins(4));

posnew=get(gca,'OuterPosition') - [Htins,Vtins]*[-1 0 2 0;0 -1 0

2];

set(gca,'position',posnew);

REshapeReport='REshapeReport: ReshapeMark=1,执行图像最大化!\n';

end

h=cell(1,2);

h={REshapeReport,ContrastReport};

(3)第一篇前14张图片对应的Matlab程序:envo_r1.m

%M-file , envo_r1.m%输入y0的值,绘制包络线轨迹.

fprintf('-----------初值输入开始-----------\n');

clear all;

y0=input('Type y0: \n(!该值必须是有理数,图像注释LATeX文本只更新有理数)\n');

absXB1= input('Type absXB1: \n(绘图边界,建议值是 12

,输入可更改,不小于Y0的绝对值,建议取值不小于 10 )\n');

Kier=input('Type REshapeMark: \n(可选值 0 和 1 ,

1--执行图形最大化;0--保持系统默认)\n');

Tayl= input('Type ContrastMark: \n(可选值 0 和 1

,1--执行对比最大化效果,蓝色细线和红色粗线方框\n分别标记最大化前坐标轴和图形边界范围,0--不做任操作)\n');

fprintf('-----------初值输入结束-----------\n开始执行,执行中...\n');

%% 以下程序用于演示一族圆系的包络线形成,内容如下:

%过直线(Lin) y=y0(y0为初值) 上任意一点 P(Point,coordinates (x0 y0)) 作抛物线(Para)

y= x^2的切线,

%切点为 A、B。%三点 P、A、B能确定一个圆 Cir,P 点坐标变化时,形成了圆系 Cir( x0,y0 )=0,

圆系的包络线

%Envo(xi,eta)=0,演示结果显示了圆系的外 非闭合曲线和内 闭合曲线。

%结合包络线方程Envo(xi,eta)=0分析,其轨迹上存在两种有趣的现象:

% 1.内 封闭曲线上,elta= C* xi^2+o(xi),其中nor是一个常数;

% 2.外 非封闭曲线上,当xi趋近无穷大时,eta值渐近一条水平线 Yasymptote=

Yinf(Yinf表示 eta的下确界).

%程序演示了这两个现象。

%以下是演示后图形的一些说明:

% 1.直线(Lin) y=y0 为紫色粗实线;

% 2.抛物线(Para) y= x^2 为黄色粗实线;

% 3.圆系 Cir( x0,y0 )=0 为一般黑体细实线;

% 4.包络线 Envo(xi,eta)=0 为红色粗实线,其内

封闭轨迹渐近(xi、eta趋近于0)抛物线 elta= C* xi^2 为青色粗虚线;

% 外

非封闭轨迹下方的渐进线Yasymptote= Yinf为蓝色粗点画线;

% 5.方程 Envo(xi,eta)=0 在 Yasymptote= Yinf 下方显示,y0

的数值在 图像标题和 x 轴标题中显示;

%% -----------(Para)y= x^2

(Lin)y=y0决定的包络线Envo(xi,eta)=0演示-----------

absXB2= absXB1 + 4;

%% --------------初值 y0 的处理开始--------------

if y0 <= 0

XL11 =

absXB1 *[ -1,1 ];

XL12 =

XL11;

else

x0=sqrt(y0);

XL11=[

-absXB1 , -x0 ]; XL12=[ x0 , absXB1 ];

end

%--------------初值 y0 处理结束--------------

XL2 = absXB2 *[ -1,1 ]

; %包络线坐标范围

Lin=@(x)

y0; % 直线(Lin) y=y0

Para=@(x)

x^2; % 抛物线(Para) y= x^2

%% --------------plot (Para) y= x^2--------------

[ m , n ]=fplot( Para , absXB1*[ -1,1 ]);

plot( m , n , 'y','linewidth',3);

hold on

%% --------------plot (Lin) y=y0 , Cir( x0,y0

)=0--------------

XL1 = XL11;

for i=1:1:2

[ m , n

]=fplot( Lin , XL1 );

plot( m , n

, 'm','linewidth',3);

for

x=linspace( XL1(1),XL1(2), ceil( 10*(XL1(2)-XL1(1)) )+1 );

a1 = x*(4*y0-1);

a2 = -1/2-4*x^2;

a0 = -y0^2+1/2*y0;

h=generalcircle(a1,a2,a0,'color','k','linewidth',0.5);%圆函数

end

if y0 <=

0

break;

else

end

XL1 = XL12;

end

%% --------------plot Envo(xi,eta)=0--------------

Envo = @(xi,eta) (eta+(4*y0-1)^2/16)*xi^2 +

(eta^2-1/2*eta-y0^2+1/2*y0) *eta;

H=ezplot( Envo , [ XL2 , XL2 ]);

set(H,'color','r','linewidth',3);

%% --------------plot elta= C* xi^2--------------

Asymptote_0 = @(xi,eta) xi^2 - (y0^2-1/2*y0)/(y0-1/4)^2 *eta

;

XOboundary = abs( y0-1/4 );

H_A0 = ezplot( Asymptote_0 , XOboundary *[ -1,1 ] );

set( H_A0 ,'color','c','linestyle','--','linewidth',3);

%% --------------plot Yasymptote= Yinf--------------

Yinf = -1/16*(4*y0-1)^2;

Yasymptote = @(x) Yinf;

[ m , n ] = fplot( Yasymptote , XL2 );

plot( m , n , 'color','b','linestyle','--','linewidth',3)

%% --------------坐标轴调整--------------

Vmax = -y0+1/2; Vmin=Yinf;

YL3 = [Vmin-1.74 , Vmax+4.74];

XL3=min(1.2*(Vmax-Vmin+6.48) , absXB2)*[ -1,1 ];

set( gca,'Xlim', XL3 );

set(gca,'Ylim', YL3 );

%% --------------图形后处理开始--------------

%% --------------LaTeX文本--------------

EQ_Envo='$\left[ {1 + {{{{(4{y_0} - 1)}^2}} \over {16\eta }}}

\right]{\xi ^2} + {\eta ^2} - {1 \over 2}\eta -

y_0^2 + {1 \over 2}{y_0} = 0\;,\;\;{y_0} = CONST$';

EQ_Cir='$Cir:\;{\xi ^2} + x(4{y_0} - 1)\xi +

{\eta ^2} - \left( {{1 \over 2} + 4{x^2}}

\right)\eta - y_0^2 + {1 \over 2}{y_0} =

0$';

EQ_Xlab='$\xi \;,\;\;when\;\;{y_0} = CONST$';

EQ_Ylab='$\eta $';

EQ_Titl='$Para:\;y = {x^2}\;,\;\;Lin:\;y = {y_0}\;,\;\;{y_0} =

CONST$';

%% --------------LaTeX文本更新--------------

const='- {{NUM} \over {DEN}}';

NdivD=y0;

[N,D]=numden(sym(NdivD));

if double(D)==1||NdivD==0

const3=char(N);

else

if NdivD

> 0

const1=strrep(const,'- ','');

else

const1=const;

end

const2=strrep(const1,'{NUM}',num2str( abs( double(N) ) ));

const3=strrep(const2,'{DEN}',char(D));

end

EQ_Envo1=strrep(EQ_Envo,'CONST',const3);

EQ_Xlab1=strrep(EQ_Xlab,'CONST',const3);

EQ_Titl1=strrep(EQ_Titl,'CONST',const3);

%% --------------LaTeX文本显示设置--------------

E1 =

text('units','normalized','Hor','center','Ver','top','fontsize',16,

...

'interpreter','latex', 'string', EQ_Envo1 );

E2 =

text('units','normalized','Hor','center','Ver','middle','fontsize',14,'fontweight','bold',

'color','M','BackgroundColor','W', ...

'interpreter','latex', 'string', EQ_Cir);

Vchar=( Vmin-YL3(1))/( YL3(2)-YL3(1) ); set(E1,'position',[0.5,Vchar-0.02]);%Envo(xi,eta)=0 LaTeX位置调整

Vchar=1-0.4*(YL3(2)-Vmax)/(YL3(2)-YL3(1) ); set(E2,'position',[0.5,Vchar]); E3=Xlabel( EQ_Xlab1,'interpreter','latex',...

'Ver','middle','fontsize',14,'color','B');

E4=Ylabel( EQ_Ylab,'interpreter','latex',...

'Ver','Middle','fontsize',14,'color','B');

E5=Title(

EQ_Titl1,'interpreter','latex','fontsize',16,'color','B');

%% --------------图形最大化设置--------------

h=kieron_taylor( 'Kieron',Kier,Tayl );

fprintf('\n%s\ny0 = %d\nabsXB1 = %d\n%s\n%s\n','Proceeding

Report...', y0,absXB1,h{1},h{2});

%% --------------End--------------

(4)15-23张图片对应的Matlab程序:envo_r1_v.m

%M-file , envo_r1_v.m%输入Y0的值,绘制包络线轨迹.

fprintf('-----------初值输入开始-----------\n');

clear all;

Y0=input('Type Y0: \n(!该值必须是有理数,图像注释LATeX文本只更新有理数)\n');

absXB1= input('Type absXB1: \n(绘图边界,建议值是 12

,输入可更改,不小于Y0的绝对值,建议取值不小于 10 )\n');

kier=input('Type REshapeMark: \n(可选值 0 和 1 ,

1--执行图形最大化;0--保持系统默认)\n');

taylor= input('Type ContrastMark: \n(可选值 0 和 1

,1--执行对比最大化效果,蓝色细线和红色粗线方框\n分别标记最大化前坐标轴和图形边界范围,0--不做任操作)\n');

fprintf('-----------初值输入结束-----------\n开始执行,执行中...\n');

%% 以下程序用于演示一族圆系的包络线形成,内容如下:

%过点P(0,Y0)(Y0为初值) 作抛物线族(Para) Y= (X+u)^2的切线,切点为 A、B。

%三点 P、A、B能确定一个圆 Cir,P 点坐标变化时,形成了圆系 Cir( x0,y0 )=0, 圆系的包络线

%Envo(xi,eta)=0,演示结果显示了圆系的外 非闭合曲线和内 闭合曲线。

%结合包络线方程Envo(xi,eta)=0分析,其轨迹上存在一种有趣的现象:

% 外

非封闭曲线上,当xi趋近无穷大时,eta值渐近一条水平线 Yasymptote= Yinf(Yinf表示

eta的下确界).

%程序演示了这两个现象。

%以下是演示后图形的一些说明:

% 1.直线过点P(0,Y0)(Lin) Y=Y0 为紫色粗实线;

% 2.抛物线族(Para) Y= (X+u)^2 为黄色粗实线;

% 3.圆系 Cir( x0,y0 )=0 为一般黑体细实线;

% 4.包络线 Envo(xi,eta)=0 为红色粗实线,外

非封闭轨迹下方的渐进线Yasymptote= Yinf为蓝色粗点画线;

% 5.方程 Envo(xi,eta)=0 在 Yasymptote= Yinf 下方显示,y0

的数值在 图像标题和 x 轴标题中显示;

%% -----------(Para)Y= (X+u)^2 定点P( 0,Y0

)决定的包络线Envo(xi,eta)=0演示-----------

absXB2= absXB1 + 4;

%% --------------初值 Y0 的处理开始--------------

if Y0 <= 0

XL11 =

absXB1*[-1,1];

XL12=XL11;

else

u0=sqrt(Y0);

XL11=[-absXB1,-u0];XL12=[u0,absXB1];

end

%% --------------初值 Y0 处理结束--------------

XL2=absXB2*[-1,1]; %包络线坐标范围

XL1=XL11;

Lin=@(x) Y0;% 直线(Lin) Y=Y0

for u= -absXB1:0.1:absXB1

[m,n]=fplot(@(X)(X+u)^2 , [XL11(1)-u , XL12(2)-u]);

plot(m,n,'y','linewidth',3);

hold

on

end

for i=1:1:2

%--------------plot (Lin) Y=Y0--------------

[m,n]=fplot(Lin , XL1);

plot(m,n,'m','linewidth',3);

%--------------plot (Para) Y= (X+u)^2--------------

for

u=linspace( XL1(1),XL1(2), ceil( 10*(XL1(2)-XL1(1)) )+1 )

%--------------plot Cir( x0,y0 )=0--------------

a1=u*(4*Y0+1);

a2=-1/2-4*u^2;

a0=4*Y0*u^2-Y0^2+1/2*Y0;

h=generalcircle(a1,a2,a0,'color','k','linewidth',0.5); %圆函数

end

if Y0 <=

0

break

else

end

XL1 =

XL12;

end

%% --------------plot Envo(xi,eta)=0--------------

Envo = @(xi,eta)( eta-Y0+(4*Y0+1)^2/16

)*xi^2+(eta^2-1/2*eta-Y0^2+1/2*Y0)*(eta-Y0);

H = ezplot(Envo,[ XL2 , XL2 ]);

set(H,'color','r','linewidth',3);

%% --------------plot Yasymptote= Yinf--------------

Yinf=Y0-(4*Y0+1)^2/16;

Yasymptote=@(x) Yinf;

[m,n]=fplot(Yasymptote, XL2 );

plot(m,n,'color','b','linestyle','--','linewidth',3)

%% --------------坐标轴调整--------------

Vmax = -Y0+1/2; Vmin = Yinf;

YL3 = [Vmin-1.74 , Vmax+4.74];

XL3=min(1.2*(Vmax-Vmin+6.48) , absXB2)*[ -1,1 ];

set( gca,'Xlim', XL3 );

set(gca,'Ylim', YL3 );

%% --------------图形后处理开始--------------

%% --------------LaTeX文本--------------

EQ_Envo='$\left[ {1 + {{{{(4{Y_0} + 1)}^2}} \over

{16(\eta - {Y_0})}}} \right]{\xi ^2} + {\eta ^2}

- {1 \over 2}\eta - Y_0^2 + {1 \over 2}{Y_0} =

0\;,\;\;{Y_0} = CONST$';

EQ_Cir='$Cir:\;{(\xi + u)^2} + u(4{Y_0} -

1)(\xi + u) + {\eta ^2} - \left( {{1 \over 2} +

4{u^2}} \right)\eta - Y_0^2 + {1 \over 2}{Y_0} =

0$';

EQ_Xlab='$\xi \;,\;\;when\;\;{Y_0} = CONST$';

EQ_Ylab='$\eta $';

EQ_Titl='$Para:\;Y = {(Y + u)^2}\;,\;\;Lin:\;Y = {Y_0}\;,\;\;{Y_0}

= CONST$';

%% --------------LaTeX文本更新--------------

const='- {{NUM} \over {DEN}}';

NdivD=Y0;

[N,D]=numden(sym(NdivD));

if double(D)==1||NdivD==0

const3=char(N);

else

if NdivD

> 0

const1=strrep(const,'- ','');

else

const1=const;

end

const2=strrep(const1,'{NUM}',num2str( abs( double(N) ) ));

const3=strrep(const2,'{DEN}',char(D));

end

EQ_Envo1=strrep(EQ_Envo,'CONST',const3);

EQ_Xlab1=strrep(EQ_Xlab,'CONST',const3);

EQ_Titl1=strrep(EQ_Titl,'CONST',const3);

%% --------------LaTeX文本显示设置--------------

E1 =

text('units','normalized','Hor','center','Ver','top','fontsize',16,

...

'interpreter','latex', 'string', EQ_Envo1 );

E2 =

text('units','normalized','Hor','center','Ver','middle','fontsize',14,'fontweight','bold',

'color','M','BackgroundColor','W', ...

'interpreter','latex', 'string', EQ_Cir);

Vchar=( Vmin-YL3(1))/( YL3(2)-YL3(1) ); set(E1,'position',[0.5,Vchar-0.02]);%Envo(xi,eta)=0 LaTeX位置调整

Vchar=1-0.42*(YL3(2)-Vmax)/(YL3(2)-YL3(1) ); set(E2,'position',[0.5,Vchar]); E3=Xlabel( EQ_Xlab1,'interpreter','latex',...\

'Ver','middle','fontsize',14,'color','B');

E4=Ylabel( EQ_Ylab,'interpreter','latex',...

'Ver','Middle','fontsize',14,'color','B');

E5=Title(

EQ_Titl1,'interpreter','latex','fontsize',16,'color','B');

%% --------------图形最大化设置--------------

hh=kieron_taylor('Tayl',taylor,'Kieron',kier);

fprintf('\n%s\nY0 = %d\nabsXB1 = %d\n%s\n%s\n','Proceeding

Report...', Y0,absXB1,hh{1},hh{2});

%% --------------End--------------

(5)24-28张图片对应的Matlab程序:envo_r2.m

%M-file , envo_r2.m%输入x0的值,绘制包络线轨迹.

fprintf('-----------初值输入开始-----------\n');

clear all;

x0=input('Type x0: \n(!该值必须是有理数,图像注释LATeX文本只更新有理数)\n');

Kieron=input('Type REshapeMark: \n(可选值 0 和 1 ,

1--执行图形最大化;0--保持系统默认)\n');

Taylor= input('Type ContrastMark: \n(可选值 0 和 1

,1--执行对比最大化效果,蓝色细线和红色粗线方框\n分别标记最大化前坐标轴和图形边界范围,0--不做任操作)\n');

fprintf('-----------初值输入结束-----------\n开始执行,执行中...\n');

%% 以下程序用于演示一族圆系的包络线形成,内容如下:

%过直线(Lin) x=x0(x0为初值) 上任意一点 P(Point,coordinates (x0 y0)) 作抛物线(Para)

y= x^2的切线,

%切点为 A、B。%三点 P、A、B能确定一个圆 Cir,P 点坐标变化时,形成了圆系 Cir( x0,y0 )=0,

圆系的包络线

%Envo(xi,eta)=0,Envo(xi,eta)=0是圆系 Cir( x0,y0 )=0的内包络线,其轨迹是椭圆,且与直线

x=x0和x=-x0相切。

%以下是演示后图形的一些说明:

% 1.直线(Lin)x=x0 为紫色粗实线;

% 2.抛物线(Para) y= x^2 为黄色粗实线;

% 3.圆系 Cir( x0,y0 )=0 为一般黑体细实线;

% 4.包络线 Envo(xi,eta)=0 为红色粗实线;

% 5.Envo(xi,eta)=0方程形式显示在标题中,y0 的数值在 图像标题和 x

轴标题中显示;

%% -----------(Para)y= x^2

(Lin)x=x0决定的包络线Envo(xi,eta)=0演示-----------

%% --------------确定XBoundary的值--------------

if x0~=0

absXB=4*abs( x0 )+ 3;

else

fprintf('\n%s\n','Error: x0 的值错误! x0 的值不能等于

0,现在执行意外中断进程...');

error('Unexpected Termination!Please recheck the VALUE of x0 and

try again later.');

end

%% ----------------------------

YL=[ -absXB^2,x0^2 ];

XL=absXB*[ -1,1 ];

%% --------------plot (Para) y= x^2 , (Lin)

x=x0--------------

Para=@(x) x^2;

[m,n]=fplot(Para ,XL );

plot(m,n,'color','b','linewidth',3);

hold on

[M,N]=fplot( @(x)x0 ,absXB^2*[ -1,1 ]);

plot( N , M , 'color','m','linewidth',3 );

%% --------------plot Cir( x0,y0 )=0--------------

for y=linspace( YL(1),YL(2), ceil( 10*(YL(2)-YL(1)) )+1 )

a1= x0*(

4*y-1 );

a2=-1/2-4*x0^2;

a0=-y^2+1/2*y;

generalcircle(a1,a2,a0,'k','linewidth',0.5);

end

%% --------------plot Envo(xi,eta)=0--------------

Envo = @(xi,eta)(1+4*x0^2)*xi^2+eta^2-(1/2+4*x0^2)*eta+1/16;

H = ezplot(Envo,[ XL , absXB^2*[-1,1] ]);

set( H ,'color','r','linewidth',3);

%% --------------坐标轴调整--------------

Xsup=abs( x0 );

Ysup=1/4+2*x0^2+sqrt(4*x0^4+x0^2 );

Yinf=1/4+2*x0^2-sqrt(4*x0^4+x0^2 );

YL3=( Ysup-Yinf )/2 * ones(1,2) + min( 1.74*( Ysup-Yinf ) , absXB^2

)*[ -1,1 ];

XL3=max( YL3(2)-YL3(1),2*absXB )/2* [ -1,1 ];

set(gca,'Xlim',XL3);

set(gca,'Ylim',YL3);

%% --------------图形后处理开始--------------

%% --------------LaTeX文本--------------

EQ_Envo='$(1 + 4x_0^2){\xi ^2} + {\eta ^2} - \left( {{1 \over 2} +

4x_0^2} \right)\eta + {1 \over {16}} =

0\;,\;\;{x_0} = CONST$';

EQ_Cir='$Cir:\;{\xi ^2} + {x_0}(4y - 1)\xi +

{\eta ^2} - \left( {{1 \over 2} + 4x_0^2}

\right)\eta - {y^2} + {1 \over 2}y = 0$';

EQ_Xlab='$\xi \;,\;\;when\;\;{x_0} = CONST$';

EQ_Ylab='$\eta $';

EQ_Titl='$Para:\;y = {x^2}\;,\;\;Lin:\;y = {x_0}\;,\;\;{x_0} =

CONST$';

%% --------------LaTeX文本更新--------------

const='- {{NUM} \over {DEN}}';

NdivD=x0;

[N,D]=numden(sym(NdivD));

if double(D)==1||NdivD==0

const3=char(N);

else

if NdivD

> 0

const1=strrep(const,'- ','');

else

const1=const;

end

const2=strrep(const1,'{NUM}',num2str( abs( double(N) ) ));

const3=strrep(const2,'{DEN}',char(D));

end

EQ_Envo1=strrep(EQ_Envo,'CONST',const3);

EQ_Xlab1=strrep(EQ_Xlab,'CONST',const3);

EQ_Titl1=strrep(EQ_Titl,'CONST',const3);

%% --------------LaTeX文本显示设置--------------

E1 =

text('units','normalized','Hor','center','Ver','bottom','fontsize',16,'fontweight','bold',...

'BackgroundColor','W', ...

'interpreter','latex', 'string', EQ_Envo1 );

E2 =

text('units','normalized','Hor','center','Ver','middle','fontsize',14,'fontweight','bold',

...

'color','R','BackgroundColor','W', ...

'interpreter','latex', 'string', EQ_Cir);

Ychar=( Ysup-YL3(1))/( YL3(2)-YL3(1) ); set(E1,'position',[0.5,Ychar+0.02]);%Envo(xi,eta)=0 LaTeX位置调整

Ychar=1-0.5*(YL3(2)-Ysup)/(YL3(2)-YL3(1) ); set(E2,'position',[0.5,Ychar]); E3=Xlabel( EQ_Xlab1,'interpreter','latex',...

'Ver','middle','fontsize',14,'color','B');

E4=Ylabel( EQ_Ylab,'interpreter','latex',...

'Ver','Middle','fontsize',14,'color','B');

E5=Title(

EQ_Titl1,'interpreter','latex','fontsize',16,'color','B');

%% --------------图形最大化设置--------------

RE=kieron_taylor( Kieron , Taylor);

fprintf('\n%s\nx0 = %d\n%s\n%s\n','Proceeding Report...',

x0,RE{1},RE{2});

%% --------------End--------------

matlab画PV曲线程序,Matlab模拟包络线形成:Envolope程序相关推荐

  1. matlab画简单曲线,并进行标注、图例、加网格,等操作

    原文地址为: 用matlab画简单曲线,并进行标注.图例.加网格,等操作 用matlab画简单曲线,并进行标注.图例.加网格,等操作 工具/原料 matlab 软件 方法/步骤 本人采用的是r2012 ...

  2. matlab绘图z=sin(x_「matlab画三维图」Matlab 应用之绘制三维图形(基础篇) - seo实验室...

    matlab画三维图 在Matlab中,三维图形的绘制包括三维曲线,三维网线图和三维曲面图.闲话不多说,直接进入正题.首先介绍几个函数: 1.plot3(x,y,z,-) 其中,x,y,z为维数相同的 ...

  3. 3.9 编写程序,模拟石头剪刀布游戏。程序随机产生一个数,这个数为2、1或0,分别表示石头剪刀和布。

    1. 题目要求编写程序,模拟石头剪刀布游戏.程序随机产生一个数,这个数为2.1或0,分别表示石头剪刀和布.提示用户输入值2.1或0.然后显示一条消息,表明用户和计算机谁赢了游戏.下面是运行示例:你出什 ...

  4. 怎样用MATLAB画二次函数曲线,matlab画二次函数图像

    [8 70 118 100 9 0 5]; 以上是每一个 X 和 Y 对应的坐标,请问如何编程能够绘制平滑曲线,这个图形就像二次函数一样的 如果要在图中绘制一条直线加上 y=...... MATLAB ...

  5. matlab中怎么画函数曲线,用matlab 怎么画函数曲线图

    matlab的数据处理能力很强大,这款软件还能绘制各种函数图形.下面我将介绍用matlab画函数图形的方法,以在同一张图上画出y1=sin(x)和y2=sin^2(x)的图形为例. 工具/原料 mat ...

  6. 用MATLAB画Bezier曲线

    关于Bezier曲线 给定n+1个空间向量Pi∈R3(i=0,1,⋯ ,n),称n次参数曲线段给定n+1个空间向量P_i\in \mathbb{R^3}(i=0,1,\cdots,n),称n次参数曲线 ...

  7. matlab roc曲线,MATLAB画ROC曲线,及计算AUC值

    标签: 根据决策值和真实标签画ROC曲线,同时计算AUC的值 function auc = roc_curve(deci,label_y) %%deci=wx+b, label_y, true lab ...

  8. matlab计算prc曲线auc面积,MATLAB画ROC曲线,及计算AUC值

    根据决策值和真实标签画ROC曲线,同时计算AUC的值 步骤: 根据决策值和真实标签画ROC曲线,同时计算AUC的值: 计算算法的决策函数值deci 根据决策函数值deci对真实标签y进行降序排序,得到 ...

  9. matlab画y x 2,matlab怎么绘制z=sqrt(x^2 y^2)的图像

    Matlab怎么绘制x^2+y^2=1曲线 [1]zhaoyucai答非所问,涉嫌抄袭.[2]风飘水渺回答正确.[3]但还有更简单的方法:>>ezplot('x^2+y^2=1',[-1. ...

  10. matlab画不定积分图像实例,matlab怎么画函数图像,原来是这样的

    函数想必大家都不陌生,有时候我们需要画出函数的图形,但是复杂的函数我们画出来花费时间太多,下面我来教大家用matlab画函数图像. 工具/材料 电脑 matlab软件 操作方法 01 先下载安装这个软 ...

最新文章

  1. ansible所有模块一览
  2. Interview:算法岗位面试—10.12上午—上海某科技公司图像算法岗位(偏图像算法,互联网AI行业)技术面试考点之LoR逻辑回归的底层代码实现、特征图计算公式
  3. 验证网站地址是否有效
  4. 2018 Multi-University Training Contest 9 杭电多校第九场 (有坑待补)
  5. oracle 删除补全日志组_浅谈Oracle 20c ASM文件组模板技术
  6. CUBA Platform 6.3的新增功能
  7. 关于Android错误 View requires API level 14 (current...
  8. 程序员工作交接文档怎么写_离职程序员交接工作被怒怼:每一行代码都必须讲清楚,不然投诉...
  9. deepin安装bochs2.6.2_2.kafka安装与使用
  10. wamp phpcms部署网站问题
  11. php循环的应用案例,php for循环的实例分享
  12. 卷积及卷积的性质与应用
  13. 什么是依赖,什么是抽象
  14. NS版暗黑破坏神3金手指开发教程(1)
  15. Altium 怎么设置鼠标滚轮放大缩小
  16. 优化iPhone 的 wifi漫游
  17. 廊坊圣洁口去医院明星同款·隐形矫正试戴会圆满举办!
  18. win10计算机ip如何更改,Win10本地连接ip怎么更改_Win10怎么更改ip地址?-192路由网...
  19. 算法可以申请专利么_国内提供计算机视觉(CV)算法岗位的公司名单
  20. 告诉你究竟DevOps是什么?

热门文章

  1. Mac自定义触控栏 Touch Bar的显示教程
  2. 30 行代码实现,支付宝蚂蚁森林自动收能量!
  3. MySQL技术内幕InnoDB存储引擎
  4. SAP MM 采购信息记录中价格单位转换因子的修改
  5. wifi和服务器之间通信协议,wifi模块串口通信协议.doc
  6. Python实现自动群发自定义QQ消息
  7. springboot配置logback日志
  8. 中科院王晓群课题组建立血管化类脑器官培养新体系
  9. 需求预测——Predicting origin-destination ride-sourcing demand with a spatio-temporal encoder-decoder
  10. 电脑mac地址的查看的三种方式