⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d080501.txt

📁 (有源代码)数值分析作业,本文主要包括两个部分,第一部分是常微分方程(ODE)的三个实验题,第二部分是有关的拓展讨论,包括高阶常微分的求解和边值问题的求解(BVP).文中的算法和算例都是基于Matla
💻 TXT
📖 第 1 页 / 共 4 页
字号:
diary on
diary off
diary on
[x2fh001,y2fh001]=rk_wjl('funtest1',0,1,1,0.01,-2);]
??? 1',0,1,1,0.01,-2);]
                      |
Missing variable or function.

[x2fh001,y2fh001]=rk_wjl('funtest1',0,1,1,0.01,-2);]
??? 1',0,1,1,0.01,-2);]
                      |
Missing variable or function.

[x2fh001,y2fh001]=rk_wjl('funtest1',0,1,1,0.01,-2);
plot(x2fh001,y2fh001)
plot(x2fh001,y2fh001)
title('wjl')
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);
[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);
[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);
[x4,4]=rk_wjl('funtest1',0,1,1,0.01,-50);
??? [x4,4]=
          |
Missing operator, comma, or semi-colon.

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);
disp(sprintf('%d',feature('SessionTool')))
0
;
dbstatus

dbstack
dbstack
;
disp(cd);
E:\matlabtemp
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);

[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);

[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);



plot(x50,y50,'--',x1,y1,'-.',x1f,y1f,'-..',x50f,y50f,'-');



legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

ylim([-1,100]);
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);

[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);

[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);



plot(x50,y50,'--',x1,y1,'-.',x1f,y1f,'-..',x50f,y50f,'-');

??? Undefined function or variable 'x50'.

disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);

[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);

[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);



plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');



legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

ylim([-1,100]);
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);

[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);

[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);



plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');



legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

ylim([-1,100]);
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);

[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);

[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);



figure(1)

plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');

legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);



figure(2)

plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');

legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

ylim([-1,100]);
[x1,y1]=rk_wjl('funtest1',0,1,1,0.01,50);

[x2,y2]=rk_wjl('funtest1',0,1,1,0.01,1);

[x3,y3]=rk_wjl('funtest1',0,1,1,0.01,-1);

[x4,y4]=rk_wjl('funtest1',0,1,1,0.01,-50);



figure(1)

plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');

legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);



figure(2)

plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');

legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

ylim([-1,100]);
ylim([-1,50]);
ylim([-1,50]);
ylim([-1,30]);
ylim([-1,30]);
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
title('y^'=\alpha*y-\alpha*x+1');
title('y^'=\alpha*y-\alpha*x+1');
??? title('y^'=
              |
Improper function reference. A "," or ")" is expected.

title('y^=\alpha*y-\alpha*x+1');
title('y^=\alpha*y-\alpha*x+1');
title('y^`=\alpha*y-\alpha*x+1');
title('y^`=\alpha*y-\alpha*x+1');
title('dydt=\alpha*y-\alpha*x+1');
title('dydt=\alpha*y-\alpha*x+1');
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
title('dydt=\alpha*y-\alpha*x+1');
title('dydt=\alpha*y-\alpha*x+1');
title('dydt=\alpha*y-\alpha*x+1');
title('dydt=\alpha*y-\alpha*x+1');
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
figure(2)

plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');

legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

title('dy/dt=\alpha*y-\alpha*x+1');

ylim([-1,30]);
figure(2)

plot(x1,y1,'--',x2,y2,'-.',x3,y3,'-..',x4,y4,'-');

legend(['\alpha=50 ';'\alpha=1  ';'\alpha=-1 ';'\alpha=-50']);

title('dy/dt=\alpha*y-\alpha*x+1');

ylim([-1,30]);
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
dbstack
;
disp(which('exact51'));
E:\matlabtemp\exact51.m
mdbstatus 'e:\matlabtemp\exact51.m'
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
y1e=exact51(x1);

figure(3)

plot(x1,y1,x1,y1e)
y1e=exact51(x1);

??? Input argument 'a' is undefined.

Error in ==> E:\matlabtemp\exact51.m
On line 5  ==> 

disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e)
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e)
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
plot(x1,y1,x1,y1e,x1,y1-y1e)
plot(x1,y1,x1,y1e,x1,y1-y1e)
ylim([-100,100])
ylim([-100,100])
axis square
axis square
axis square
axis square
lengend
??? Undefined function or variable 'lengend'.

legend
legend([1,2,3,4])
??? Index exceeds matrix dimensions.

Error in ==> E:\matlab5\MATLAB\toolbox\matlab\graph2d\legend.m
On line 174  ==> elseif ishandle(varargin{1}) % legend(h,strings,...)

legend([1,2,3])
??? Index exceeds matrix dimensions.

Error in ==> E:\matlab5\MATLAB\toolbox\matlab\graph2d\legend.m
On line 174  ==> elseif ishandle(varargin{1}) % legend(h,strings,...)

legend(['1','2','3'])
legend(['1';'2';'3'])
help legend

 LEGEND Graph legend.
    LEGEND(string1,string2,string3, ...) puts a legend on the current plot
    using the specified strings as labels. LEGEND works on line graphs,
    bar graphs, pie graphs, ribbon plots, etc.  You can label any
    solid-colored patch or surface object.  The fontsize and fontname for
    the legend strings matches the axes fontsize and fontname.
 
    LEGEND(H,string1,string2,string3, ...) puts a legend on the plot
    containing the handles in the vector H using the specified strings as
    labels for the corresponding handles.
 
    LEGEND(M), where M is a string matrix or cell array of strings, and
    LEGEND(H,M) where H is a vector of handles to lines and patches also
    works.
 
    LEGEND(AX,...) puts a legend on the axes with handle AX.
 
    LEGEND OFF removes the legend from the current axes.
    LEGEND(AX,'off') removes the legend from the axis AX.
 
    LEGH = LEGEND returns the handle to legend on the current axes or
    empty if none exists.
 
    LEGEND with no arguments refreshes all the legends in the current
    figure (if any).  LEGEND(LEGH) refreshes the specified legend.
 
    LEGEND(...,Pos) places the legend in the specified
    location:
        0 = Automatic "best" placement (least conflict with data)
        1 = Upper right-hand corner (default)
        2 = Upper left-hand corner
        3 = Lower left-hand corner
        4 = Lower right-hand corner
       -1 = To the right of the plot
 
    To move the legend, press the left mouse button on the legend and drag
    to the desired location. Double clicking on a label allows you to edit
    the label.
 
    [LEGH,OBJH] = LEGEND(...) returns a handle LEGH to the legend axes and
    vector OBJH containing the text, line, and patch handles.
 
    LEGEND will try to install a ResizeFcn on the figure if it hasn't been
    defined before.  This resize function will try to keep the legend the
    same size.
 
    Examples:
        x = 0:.2:12;
        plot(x,bessel(1,x),x,bessel(2,x),x,bessel(3,x));
        legend('First','Second','Third');
        legend('First','Second','Third',-1)
 
        b = bar(rand(10,5),'stacked'); colormap(summer); hold on
        x = plot(1:10,5*rand(10,1),'marker','square','markersize',12,...
                 'markeredgecolor','y','markerfacecolor',[.6 0 .6],...
                 'linestyle','-','color','r','linewidth',2); hold off
        legend([b,x],'Carrots','Peas','Peppers','Green Beans',...
                  'Cucumbers','Eggplant')       
 
    See also PLOT.

figure

        b = bar(rand(10,5),'stacked'); colormap(summer); hold on
        x = plot(1:10,5*rand(10,1),'marker','square','markersize',12,...
                 'markeredgecolor','y','markerfacecolor',[.6 0 .6],...
                 'linestyle','-','color','r','linewidth',2); hold off
        legend([b,x],'Carrots','Peas','Peppers','Green Beans',...
                  'Cucumbers','Eggplant')       
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e,x1,y1-y1e)

ylim([-100,100])



axis square
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e,x1,y1-y1e)

ylim([-100,100])



axis square
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e,x1,y1-y1e)

%ylim([-100,100])

legend('\alpha=50','exact solution','error');


y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e,x1,y1-y1e)

%ylim([-100,100])

legend('\alpha=50','exact solution','error');

figure(4)

plot(x1,y1,x1,y1e,x1,y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
figure(4)

plot(x1,y1,x1,y1e,x1,y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e,'*',x1,y1-y1e)

%ylim([-100,100])

legend('\alpha=50','exact solution','error');



figure(4)

plot(x1,y1,x1,y1e,x1,'*',y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
y1e=exact51(x1,50);

figure(3)

plot(x1,y1,x1,y1e,'*',x1,y1-y1e)

%ylim([-100,100])

legend('\alpha=50','exact solution','error');



figure(4)

plot(x1,y1,x1,y1e,x1,'*',y1-y1e)

??? Error using ==> plot
Not enough input arguments.

figure(4)

plot(x1,y1,x1,y1e,x1,'*',y1-y1e)
figure(4)

plot(x1,y1,x1,y1e,x1,'*',y1-y1e)
??? Error using ==> plot
Not enough input arguments.

disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
figure(4)

plot(x1,y1,x1,y1e,x1,y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
figure(4)

plot(x1,y1,x1,y1e,x1,y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
plot(x1,y1,'o',x1,y1e,x1,y1-y1e)
plot(x1,y1,'o',x1,y1e,x1,y1-y1e)
plot(x1,y1,x1,y1e,'o',x1,y1-y1e)
plot(x1,y1,x1,y1e,'o',x1,y1-y1e)
figure(4)

plot(x1,y1,x1,y1e,'o',x1,y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
figure(4)

plot(x1,y1,x1,y1e,'o',x1,y1-y1e)

ylim([-1000,1000])

legend('\alpha=50','exact solution','error');
plot(x1,y1,x1,y1e,'.',x1,y1-y1e)
plot(x1,y1,x1,y1e,'.',x1,y1-y1e)
figure(4)

plot(x1,y1,x1,y1e,'.',x1,y1-y1e)

ylim([-100,100])

legend('\alpha=50','exact solution','error');
figure(4)

plot(x1,y1,x1,y1e,'.',x1,y1-y1e)

ylim([-100,100])

legend('\alpha=50','exact solution','error');
disp(which('rk51test'));
E:\matlabtemp\rk51test.m
clear 'e:\matlabtemp\rk51test.m'
help plot

 PLOT   Linear plot. 
    PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix,
    then the vector is plotted versus the rows or columns of the matrix,
    whichever line up.  If X is a scalar and Y is a vector, length(Y)
    disconnected points are plotted.
 
    PLOT(Y) plots the columns of Y versus their index.
    If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).
    In all other uses of PLOT, the imaginary part is ignored.
 
    Various line types, plot symbols and colors may be obtained with
    PLOT(X,Y,S) where S is a character string made from one element
    from any or all the following 3 colunms:
 
           y     yellow        .     point              -     solid
           m     magenta       o     circle             :     dotted
           c     cyan          x     x-mark             -.    dashdot 
           r     red           +     plus               --    dashed   
           g     green         *     star
           b     blue          s     square
           w     white         d     diamond
           k     black         v     triangle (down)
                               ^     triangle (up)
                               <     triangle (left)
                               >     triangle (right)
                               p     pentagram
                               h     hexagram
                          
    For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus 
    at each data point; PLOT(X,Y,'bd') plots blue diamond at each data 
    point but does not draw any line.
 
    PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by
    the (X,Y,S) triples, where the X's and Y's are vectors or matrices 
    and the S's are strings.  
 
    For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a
    solid yellow line interpolating green circles at the data points.
 
    The PLOT command, if no color is specified, makes automatic use of
    the colors specified by the axes ColorOrder property.  The default
    ColorOrder is listed in the table above for color systems where the
    default is yellow for one line, and for multiple lines, to cycle
    through the first six colors in the table.  For monochrome systems,
    PLOT cycles over the axes LineStyleOrder property.
 
    PLOT returns a column vector of handles to LINE objects, one
    handle per line. 
 
    The X,Y pairs, or X,Y,S triples, can be followed by 
    parameter/value pairs to specify additional properties 
    of the lines.
                                    
    See also SEMILOGX, SEMILOGY, LOGLOG, GRID, CLF, CLC, TITLE,
    XLABEL, YLABEL, AXIS, AXES, HOLD, COLORDEF, LEGEND, and SUBPLOT.

help axis

 AXIS  Control axis scaling and appearance.
    AXIS([XMIN XMAX YMIN YMAX]) sets scaling for the x- and y-axes
       on the current plot.
    AXIS([XMIN XMAX YMIN YMAX ZMIN ZMAX]) sets the scaling for the
       x-, y- and z-axes on the current 3-D plot.
    V = AXIS returns a row vector containing the scaling for the
       current plot.  If the current view is 2-D, V has four
       components; if it is 3-D, V has six components.
 
    AXIS AUTO  returns the axis scaling to its default, automatic
       mode where, for each dimension, 'nice' limits are chosen based
       on the extents of all line, surface, patch, and image children.
    AXIS MANUAL  freezes the scaling at the current limits, so that if
       HOLD is turned on, subsequent plots will use the same limits.
    AXIS TIGHT  sets the axis limits to the range of the data.
    AXIS FILL  sets the axis limits and PlotBoxAspectRatio so that
       the axis fills the position rectangle.  This option only has
       an effect if PlotBoxAspectRatioMode or DataAspectRatioMode are
       manual.
 
    AXIS IJ  puts MATLAB into its "matrix" axes mode.  The coordinate
       system origin is at the upper left corner.  The i axis is
       vertical and is numbered from top to bottom.  The j axis is

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -