导航:首页 > 源码编译 > 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源码相关的资料

热点内容
工作三年的大专程序员 浏览:728
java毕业设计文献 浏览:143
筹码集中度指标源码 浏览:482
listsortjava 浏览:186
plc闪光电路编程实例 浏览:299
socket编程试题 浏览:206
华为的服务器怎么设置从光驱启动 浏览:871
程序员真的累吗 浏览:328
学信网app为什么刷脸不了 浏览:874
天蝎vs程序员 浏览:996
单片机下载口叫什么 浏览:190
程序员的道 浏览:926
云服务器不实名违法吗 浏览:558
怎样查看文件夹图片是否重复 浏览:995
文件怎么导成pdf文件 浏览:808
打开sql表的命令 浏览:103
安卓手机如何面部支付 浏览:38
天元数学app为什么登录不上去 浏览:825
明日之后为什么有些服务器是四个字 浏览:104
安卓系统l1是什么意思 浏览:26