零階一類貝塞爾函數曲線及其信封 matlab來源程式

來源:互聯網
上載者:User

廢話不多說,請看來源程式:

clear ,clc;format longx=(0:0.01:100)';y_0=besselj(0,x);% y_1=besselj(1,x); %一階,這裡只畫了0階% y_2=besselj(2,x); %二階plot(x,y_0);grid on;axis([0,100,-1,1]);title('0階貝塞爾函數曲線圖');xlabel('Variable X');ylabel('Variable Y');%畫信封hold on;[up,down] = envelope(x,y_0,'spline');plot(x, up, 'r');plot(x, down, 'r');

其中的envelope是個單獨的.m檔案,是個函數,用來畫信封。說白了就是求拐點然後插值:

function [up,down] = envelope(x,y,interpMethod)%ENVELOPE gets the data of upper and down envelope of the known input (x,y).%% Input parameters:% x the abscissa of the given data% y the ordinate of the given data% interpMethod the interpolation method%% Output parameters:% up the upper envelope, which has the same length as x.% down the down envelope, which has the same length as x.%% See also DIFF INTERP1% Designed by: Lei Wang, <WangLeiBox@hotmail.com>, 11-Mar-2003.% Last Revision: 21-Mar-2003.% Dept. Mechanical & Aerospace Engineering, NC State University.% $Revision: 1.1 $ $Date: 3/21/2003 10:33 AM $if length(x) ~= length(y)error('Two input data should have the same length.');endif (nargin < 2)|(nargin > 3),error('Please see help for INPUT DATA.');elseif (nargin == 2)interpMethod = 'linear';end% Find the extreme maxim values % and the corresponding indexes%----------------------------------------------------extrMaxValue = y(find(diff(sign(diff(y)))==-2)+1);extrMaxIndex = find(diff(sign(diff(y)))==-2)+1;% Find the extreme minim values % and the corresponding indexes%----------------------------------------------------extrMinValue = y(find(diff(sign(diff(y)))==+2)+1);extrMinIndex = find(diff(sign(diff(y)))==+2)+1;up = extrMaxValue;up_x = x(extrMaxIndex);down = extrMinValue;down_x = x(extrMinIndex);% Interpolation of the upper/down envelope data%----------------------------------------------------up = interp1(up_x,up,x,interpMethod); down = interp1(down_x,down,x,interpMethod); 

效果:

來源程式下載:http://www.pudn.com/downloads495/sourcecode/windows/other/detail2062657.html

csdn上傳資源標籤裡竟然沒有Matlab,桑不起啊。。。。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.