1.求MATLAB里imread这个函数的函数函数源代码
2.MATLAB里bd_asymp函数源代码是什么?
3.matlab求1-10的阶乘的函数源程序及算法解释。
4.如何调出MATLAB内部函数的源码源码源程序?
求MATLAB里imread这个函数的源代码
function [X, map, alpha] = imread(varargin)
[filename, format, extraArgs, msg] = parse_inputs(varargin{ :});
if (~isempty(msg))
error('MATLAB:imread:inputParsing', '%s', msg);
end
% Download remote file.
if (strfind(filename, '://'))
url = true;
if (~usejava('mwt'))
error('MATLAB:imread:noJava', 'Reading from a URL requires a Java Virtual Machine.')
end
try
filename = urlwrite(filename, tempname);
catch
error('MATLAB:imread:readURL', 'Can''t read URL "%s".', filename);
end
else
url = false;
end
if (isempty(format))
% The format was not specified explicitly.
% Verify that the file exists.
fid = fopen(filename, 'r');
if (fid == -1)
if ~isempty(dir(filename))
error('MATLAB:imread:fileOpen', ['Can''t open file "%s" for reading;\nyou' ...
' may not have read permission.'], ...
filename);
else
error('MATLAB:imread:fileOpen', 'File "%s" does not exist.', filename);
end
else
% File exists. Get full filename.
filename = fopen(fid);
fclose(fid);
end
% Try to determine the file type.
format = imftype(filename);
if (isempty(format))
error('MATLAB:imread:fileFormat', 'Unable to determine the file format.');
end
else
% The format was specified explicitly.
% Verify that the file exists.
fid = fopen(filename, 'r');
if (fid == -1)
% Couldn't open using the given filename; search for a
% file with an appropriate extension.
fmt_s = imformats(format);
if (isempty(fmt_s))
error('MATLAB:imread:fileFormat', ['Couldn''t find format %s in the format registry.' ...
' See "help imformats".'], format);
end
for p = 1:length(fmt_s.ext)
fid = fopen([filename '.' fmt_s.ext{ p}]);
if (fid ~= -1)
% The file was found. Don't continue searching.
break
end
end
end
if (fid == -1)
if ~isempty(dir(filename))
error('MATLAB:imread:fileOpen', ['Can''t open file "%s" for reading;\nyou' ...
' may not have read permission.'], ...
filename);
else
error('MATLAB:imread:fileOpen', 'File "%s" does not exist.', filename);
end
else
filename = fopen(fid);
fclose(fid);
end
end
% Get format details.
fmt_s = imformats(format);
% Verify that a read function exists
if (isempty(fmt_s.read))
error('MATLAB:imread:readFunctionRegistration', 'No reading function for format %s. See "help imformats".', ...
fmt_s.ext{ 1});
end
if ((fmt_s.alpha) && (nargout == 3))
% Use the alpha channel.
[X, map, alpha] = feval(fmt_s.read, filename, extraArgs{ :});
else
% Alpha channel is not requested or is not applicable.
alpha = [];
[X, map] = feval(fmt_s.read, filename, extraArgs{ :});
end
% Delete temporary file from Internet download.
if (url)
delete_download(filename);
end
%%%
%%% Function delete_download
%%%
function delete_download(filename)
try
delete(filename);
catch
warning('MATLAB:imread:tempFileDelete', 'Can''t delete temporary file "%s".', filename)
end
%%%
%%% Function parse_inputs
%%%
function [filename, format, extraArgs, msg] = ...
parse_inputs(varargin)
filename = '';
format = '';
extraArgs = { };
msg = '';
% Parse arguments based on their number.
switch(nargin)
case 0
% Not allowed.
msg = 'Too few input arguments.';
return;
case 1
% Filename only.
filename = varargin{ 1};
otherwise
% Filename and format or other arguments.
filename = varargin{ 1};
% Check whether second argument is a format.
if (ischar(varargin{ 2}))
fmt_s = imformats(varargin{ 2});
else
fmt_s = struct([]);
end
if (~isempty(fmt_s))
% The argument matches a format.
format = varargin{ 2};
extraArgs = varargin(3:end);
else
% The argument begins the format-specific parameters.
extraArgs = varargin(2:end);
end
end
MATLAB里bd_asymp函数源代码是什么?
具体函数如下所示,
function [wpos,函数函数ypos]=bd_asymp(G,w)
G1=zpk(G); Gtf=tf(G);
if nargin==1,
w=freqint2(Gtf.num{ 1},Gtf.den{ 1},);
end
zer=G1.z{ 1}; pol=G1.p{ 1}; gain=G1.k;
wpos=[]; pos1=[];
for i=1:length(zer);
if isreal(zer(i))
wpos=[wpos, abs(zer(i))];
pos1=[pos1,];
else
if imag(zer(i))>0
wpos=[wpos, abs(zer(i))];
pos1=[pos1,];
end, end, end
for i=1:length(pol);
if isreal(pol(i))
wpos=[wpos, abs(pol(i))];
pos1=[pos1,-];
else
if imag(pol(i))>0
wpos=[wpos, abs(pol(i))];
pos1=[pos1,-];
end, end, end
wpos=[wpos w(1) w(length(w))];
pos1=[pos1,0,0];
[wpos,ii]=sort(wpos); pos1=pos1(ii);
ii=find(abs(wpos)<eps); kslp=0;
w_start=*eps;
if length(ii)>0,
kslp=sum(pos1(ii));
ii=(ii(length(ii))+1):length(wpos);
wpos=wpos(ii); pos1=pos1(ii);
end
while 1
[ypos1,pp]=bode(G,w_start);
if isinf(ypos1), w_start=w_start*;
else, break; end
end
wpos=[w_start wpos];
ypos(1)=*log(ypos1);
pos1=[kslp pos1];
for i=2:length(wpos)
kslp=sum(pos1(1:i-1));
ypos(i)=ypos(i-1)+...
kslp*log(wpos(i)/wpos(i-1));
end
ii=find(wpos>=w(1)&wpos<=w(length(w)));
wpos=wpos(ii); ypos=ypos(ii);
matlab求1-的阶乘的函数源程序及算法解释。
源程序代码以及算法解释如下:matlab求1-的源码源码turnjs书刊页面制作源码阶乘的函数源码如下:
function p = factorial()
p=1;
for a=1:%设置要求的阶乘
for i=1:a%循环遍历从1到a
p=p*i;%遍历相乘
end;//函数结束
p%输出结果
p=1;%p还原其初始值
end
end
程序运行结果如下:
扩展资料:
C++实现求1到的阶乘之和,代码如下:
#include<stdio.h>
int main()
{
double a,函数函数b=1,sum=0;
for(a=1;a<=;a++)
{
b = a*b; /* 原理:1!等于1乘以1,源码源码苹果手机直播源码2!函数函数等于1!源码源码乘以2,函数函数3!源码源码等于2!函数函数乘以3,源码源码以此类推 ,函数函数云蹦迪软件源码!源码源码等于9!函数函数乘以 */
sum = sum+b; /* 依次将1到的驱动如何提取源码阶乘相加 */
}
printf("%lf\n",sum);
return 0;
}
同理,如果求一个已知整数Number1到另一个已知整数Number2的阶乘之和,只需在代码里做以下修改和替换:
#include<stdio.h>
int main()
{
double a,b=1,sum=0;
for(a=Number1;a<=Number2;a++) /* 在此处用具体的值替换Number1和Number2,如求到的画皮世界源码下载阶乘之和,只需在此处用替换Number1,替换Number2 */
{
b = a*b;
sum = sum+b;
}
printf("%lf\n",sum);
return 0;
}
如何调出MATLAB内部函数的源程序?
MATLB的函数源程序都存放在MATLAB安装文件夹内的toolbox文件夹下,这些函数都是.m文件,可以用搜索文件的方法搜索函数名找到这个函数的.m文件。
也可以在MATLAB主界面内输入edit函数名,用M-fileEditor打开这个函数的源程序。