導航:首頁 > 源碼編譯 > matlab源碼

matlab源碼

發布時間:2022-01-19 06:00:09

㈠ 如何察看matlab內置函數的源程序

MATALB屬於半開源軟體,其中很多函數可以通過「open/edit/type+filename」命令進行編輯和查看源代碼。但是有一些函數僅僅可以找到它的幫助文檔,卻無法看到具體的源代碼,比如min,fft,sum等函數,因為這些函數屬於MATLAB的built-in function(內置函數),即MATLAB的built-in function的代碼是不公開的,有人說這些函數的演算法是最優化的,保證較低的時間復雜度提高效率,所以,我感覺寫一個演算法優先考慮調用MATLAB自帶函數,自帶函數解決不了的情況下,再自己去寫,畢竟自己寫的代碼的效率無法達到最優。
要確定哪些函數可以看代碼哪些函數不可以看代碼,可以通過which命令:

上圖中的函數fft, sum, min屬於MATLAB的built-in function,無法看代碼,只能通過「help/type+filename」來看幫助文檔,通過這個路徑一路查下去,M文件裡面也只有幫助文檔,沒有源代碼。最後一個函數axis.m就不是built-in函數,可以通過 「edit/open/type +filename」來查看源代碼。

㈡ matlab 源代碼

%後邊不都是已經加註釋了嗎?
不了解應用情況,解答這個代碼很難的。
推薦:
www.ilovematlab.com!
論壇版主很強!

㈢ 在matlab中IntLp函數的源代碼

function[x,y]=IntLp(f,G,h,Geq,heq,lb,ub,x,id,options)
%整數線性規劃分枝定界法,可求解全整數線性或混合整數線性規劃。
%y=minf'*xsubjectto:G*x<=hGeq*x=heqx為全整數或混合整%數列向量
%用法
%[x,y]=IntLp(f,G,h)
%[x,y]=IntLp(f,G,h,Geq,heq)
%[x,y]=IntLp(f,G,h,Geq,heq,lb,ub)
%[x,y]=IntLp(f,G,h,Geq,heq,lb,ub,x)
%[x,y]=IntLp(f,G,h,Geq,heq,lb,ub,x,id)
%[x,y]=IntLp(f,G,h,Geq,heq,lb,ub,x,id,options)
%參數說明
%x:最優解列向量;y:目標函數最小值;f:目標函數系數列向量
%G:約束不等式條件系數矩陣;h:約束不等式條件右端列向量
%Geq:約束等式條件系數矩陣;heq:約束等式條件右端列向量
%lb:解的下界列向量(Default:-inf);ub:解的上界列向量(Default:inf)
%x:迭代初值列向量;
%id:整數變數指標列向量,1-整數,0-實數(Default:1)
%options的設置請參見optimset或lingprog
%例minZ=x1+4x2
%s.t.2x1+x2<=8
%x1+2x2>=6
%x1,x2>=0且為整數
%先將x1+2x2>=6化為-x1-2x2<=-6
%[x,y]=IntLp([1;4],[21;-1-2],[8;-6],[],[],[0;0])

%胡良劍,孫曉君,Matlab數學實驗,高等教育出版社,2006

;
ifnargin<10,options=optimset({});options.Display='off';
options.LargeScale='off';end
ifnargin<9,id=ones(size(f));end
ifnargin<8,x=[];end
ifnargin<7|isempty(ub),ub=inf*ones(size(f));end
ifnargin<6|isempty(lb),lb=zeros(size(f));end
ifnargin<5,heq=[];end
ifnargin<4,Geq=[];end
upper=inf;c=f;x0=x;A=G;b=h;Aeq=Geq;beq=heq;ID=id;
ftemp=ILP(lb(:),ub(:));
x=opt;y=upper;
%以下子函數
functionftemp=ILP(vlb,vub)
;
[x,ftemp,how]=linprog(c,A,b,Aeq,beq,vlb,vub,x0,options);
ifhow<=0
return;
end;
ifftemp-upper>0.00005%inordertoavoiderror
return;
end;
ifmax(abs(x.*ID-round(x.*ID)))<0.00005
ifupper-ftemp>0.00005%inordertoavoiderror
opt=x';upper=ftemp;
return;
else
opt=[opt;x'];
return;
end;end;
notintx=find(abs(x-round(x))>=0.00005);%inordertoavoiderror
intx=fix(x);tempvlb=vlb;tempvub=vub;
ifvub(notintx(1,1),1)>=intx(notintx(1,1),1)+1
tempvlb(notintx(1,1),1)=intx(notintx(1,1),1)+1;
ftemp=ILP(tempvlb,vub);
end;
ifvlb(notintx(1,1),1)<=intx(notintx(1,1),1)
tempvub(notintx(1,1),1)=intx(notintx(1,1),1);
ftemp=ILP(vlb,tempvub);
end;

㈣ matlab源代碼

hrollfcoef這個函數不是matlab自帶的

function [xh] = hrollfcoef(irfn,ipoint,sr,alfs,ncc)

%****************** variables *************************
% irfn : Number of symbols to use filtering
% ipoint : Number of samples in one symbol
% sr : symbol rate
% alfs : rolloff coeficiense
% ncc : 1 -- transmitting filter 0 -- receiving filter
% *****************************************************

xi=zeros(1,irfn*ipoint+1);
xq=zeros(1,irfn*ipoint+1);

point = ipoint;
tr = sr ;
tstp = 1.0 ./ tr ./ ipoint;
n = ipoint .* irfn;
mid = ( n ./ 2 ) + 1;
sub1 = 4.0 .* alfs .* tr; % 4*alpha*R_s

for i = 1 : n

icon = i - mid;
ym = icon;

if icon == 0.0
xt = (1.0-alfs+4.0.*alfs./pi).* tr; % h(0)
else
sub2 =16.0.*alfs.*alfs.*ym.*ym./ipoint./ipoint;
if sub2 ~= 1.0
x1=sin(pi*(1.0-alfs)/ipoint*ym)./pi./(1.0-sub2)./ym./tstp;
x2=cos(pi*(1.0+alfs)/ipoint*ym)./pi.*sub1./(1.0-sub2);
xt = x1 + x2; % h(t) plot((1:length(xh)),xh)
else % (4alphaRst)^2 = 1plot((1:length(xh)),xh)
xt = alfs.*tr.*((1.0-2.0/pi).*cos(pi/4.0/alfs)+(1.0+2.0./pi).*sin(pi/4.0/alfs))./sqrt(2.0);
end % if sub2 ~= 1.0
end % if icon == 0.0

if ncc == 0 % in the case of receiver
xh( i ) = xt ./ ipoint ./ tr; % normalization
elseif ncc == 1 % in the case of transmitter
xh( i ) = xt ./ tr; % normalization
else
error('ncc error');
end % if ncc == 0

end % for i = 1 : n

%******************** end of file ***************************

網上找的,你看看能不能拼到你那個程序里去

㈤ 怎麼查看matlab函數源代碼

方法1:直接去安裝目錄找,在安裝目錄下toolbox里,「盤:\Program Files\MATLAB\R2013a\toolbox」里,不好找,作為一種方法,提一句,但是不好用。
方法2:函數調,open 函數名;例如:打開while函數m文件,運行:
open while;
就會打開while.m文件。輸入edit whlie效果一樣。
方法3:編輯出錯,m文件自動會彈出。

㈥ Matlab卷積和源代碼

一維卷積用conv(A,B,'same')
二維卷積用conv2(A,B,'same')

CONV Convolution and polynomial multiplication.
C = CONV(A, B) convolves vectors A and B. The resulting vector is
length MAX([LENGTH(A)+LENGTH(B)-1,LENGTH(A),LENGTH(B)]). If A and B are
vectors of polynomial coefficients, convolving them is equivalent to
multiplying the two polynomials.

C = CONV(A, B, SHAPE) returns a subsection of the convolution with size
specified by SHAPE:
'full' - (default) returns the full convolution,
'same' - returns the central part of the convolution
that is the same size as A.
'valid' - returns only those parts of the convolution
that are computed without the zero-padded edges.
LENGTH(C)is MAX(LENGTH(A)-MAX(0,LENGTH(B)-1),0).

Class support for inputs A,B:
float: double, single

CONV2 Two dimensional convolution.
C = CONV2(A, B) performs the 2-D convolution of matrices A and B.
If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).

C = CONV2(H1, H2, A) convolves A first with the vector H1 along the
rows and then with the vector H2 along the columns. If n1 = length(H1)
and n2 = length(H2), then mc = max([ma+n1-1,ma,n1]) and
nc = max([na+n2-1,na,n2]).

C = CONV2(..., SHAPE) returns a subsection of the 2-D
convolution with size specified by SHAPE:
'full' - (default) returns the full 2-D convolution,
'same' - returns the central part of the convolution
that is the same size as A.
'valid' - returns only those parts of the convolution
that are computed without the zero-padded edges.
size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).

㈦ 急求能在matlab裡面正確運行的matlab源代碼!!!

可以啊。先把源代碼保存為.m文件,然後按照公式,輸入參數就可以了
比如第一個輸入frft(1,2),具體看f和a的值了

㈧ 大家的matlab源代碼都從哪兒找的

論壇,csdn很多的

㈨ matlab源代碼是什麼樣子的

一般來說,較大型的軟體,通常都是由若干種語言和開發技術共同完成的。他們的開發也是由多個小組分別使用不同技術開發不同的組件,最後組合而成。

他的大多數文件使用 VC++ 書寫,你可以看到他的安裝包包含 vcredist_x86,這是典型的VC++的運行時庫。

另外,matlab 還使用了 Perl,Python 等開發語言或技術。當然還有 Java。你也可以在安裝目錄發現類似的支持文件,例如 JavaAccessBridge.dll

甚至不止是桌面程序,matlab 還使用了很多瀏覽器和伺服器端的開發工具和架構。

最後,還有一大堆的工具箱,是 matlab 自身腳本書寫的。

如果你想看某個函數的腳本,可以在命令窗中輸入:edit 函數名 ,再按回車。

㈩ matlab中一個源代碼,幫我解釋一下這些代碼每一句的意思唄,急用

clf reset%清除圖形內容並重置圖形特性
H=axes('unit','normalized','position',[0,0,1,1],'visible','off');%生成坐標軸圖柄H
set(gcf,'currentaxes',H);%設置當前圖形坐標軸
str='\fontname{隸書}歸一化二階系統的階躍響應曲線';%生成一個隸書字串,用於後面命名
text(0.12,0.93,str,'fontsize',13);%在圖中寫上面的字串
h_fig=get(H,'parent');%獲得H的特性並生成圖h
set(h_fig,'unit','normalized','position',[0.1,0.2,0.7,0.4]);%設置圖形h的位置及大小
h_axes=axes('parent',h_fig,...
'unit','normalized','position',[0.1,0.15,0.55,0.7],...
'xlim',[0 15],'ylim',[0 1.8],'fontsize',8);%生成圖形h的坐標軸
h_text=uicontrol(h_fig,'style','text',...
'unit','normalized','position',[0.67,0.73,0.25,0.14],...
'horizontal','left','string',{'輸入阻尼比系數','zeta ='});%在圖h中生成一個文本控制項,要求輸入zeta值
h_edit=uicontrol(h_fig,'style','edit',...
'unit','normalized','position',[0.67,0.59,0.25,0.14],...
'horizontal','left',...
'callback',[...
'z=str2num(get(gcbo,''string''));',...
't=0:0.1:15;',...
'for k=1:length(z);',...
's2=tf(1,[1 2*z(k) 1]); ',...
'y(:,k)=step(s2,t);',...
'plot(t,y(:,k));',...
'if (length(z)>1) ,hold on,end,',...
'end;',...
'hold off,']);%生成一個編輯控制項,根據zeta值畫圖
h_push1=uicontrol(h_fig,'style','push',...
'unit','normalized','position',[0.67,0.37,0.12,0.15],...
'string','grid on','callback','grid on');%生成一個按鈕控制項,用於在圖中畫網格
h_push2=uicontrol(h_fig,'style','push',...
'unit','normalized','position',[0.67,0.15,0.12,0.15],...
'string','grid off','callback','grid off');%生成一個按鈕控制項,用於消除圖中的網格

閱讀全文

與matlab源碼相關的資料

熱點內容
工作三年的大專程序員 瀏覽:726
java畢業設計文獻 瀏覽:140
籌碼集中度指標源碼 瀏覽:478
listsortjava 瀏覽:183
plc閃光電路編程實例 瀏覽:299
socket編程試題 瀏覽:204
華為的伺服器怎麼設置從光碟機啟動 瀏覽:868
程序員真的累嗎 瀏覽:326
學信網app為什麼刷臉不了 瀏覽:873
天蠍vs程序員 瀏覽:992
單片機下載口叫什麼 瀏覽:188
程序員的道 瀏覽:926
雲伺服器不實名違法嗎 瀏覽:558
怎樣查看文件夾圖片是否重復 瀏覽:995
文件怎麼導成pdf文件 瀏覽:808
打開sql表的命令 瀏覽:103
安卓手機如何面部支付 瀏覽:38
天元數學app為什麼登錄不上去 瀏覽:824
明日之後為什麼有些伺服器是四個字 瀏覽:104
安卓系統l1是什麼意思 瀏覽:26