导航→ | 『Matlab视频下载』 | 『Matlab研讨会』 | 『Matlab书籍购买』 | 『生活百宝箱』| 捐助论坛,在线获取M币 | 『联系我们』
新手必读 | 论坛下载指南论坛热心会员访谈 | 12月热心会员IE8会员贴图帮助 | RSS订阅帖子
 
 
 
发新话题
打印

论坛的成就--我们一直在努力

本主题由 math 于 2009-6-22 14:07 解除高亮
支持
点击这里,看看谁在分享知识吧....
支持楼主了,
怎样让MATLAB GUI制作的界面脱离MATLAB环境独立运行?真诚希望您的回复!liaoshaohui@126.com

求教高手

原函数为:
function x = diedai(A,c,x0,method,w,tol,trace)
if nargin < 6 | isempty(tol) 
    tol = 1e-6;
end
if nargin >= 6 & tol == 0
    tol = 1e-6;
end  
if nargin < 7 | isempty(trace)
    trace = 0;
end
if trace
    fprintf('\n Initial guess:\n')
    fprintf('%8.6g ',x0)
end

c = (c(.')';
x0 = (x0(.')';

n = length(c);
[nr nc] = size(A);

if nr ~= nc
   error('Coefficient matrix is not square.')
end
if nr ~= n
   error('Coefficient matrix and vector of constants do not have the same length.')
end
if length(x0) ~= n
   error('Vector of unknowns and vector of constants do not have the same length.')
end

if det(A) == 0
   fprintf('\n Rank = %7.3g\n',rank(A))
   error('The coefficient matrix is singular.')
end
iter = 0;

if method = 1
    D = diag(diag(A));
    a0 = inv(D) * A - eye(n);
    c0 = inv(D) * c;
    x = x0;
    x0 = x + 2 * tol;
    while max(abs(x-x0)) >= tol
        x0 = x;
        x = c0-a0 * x0;
    end
end
if method = 2
    L = tril(A);
    U = triu(A);
    c0 = inv(L) * c;
    a0 = inv(L) * (U-diag(diag(A)));
    x = x0;
    x0 = x + 2 * tol;
    while max(abs(x-x0)) >= tol
        x0 = x;
        x = c0 - a0 * x0;
    end
end
if method = 3
    w = input('请输入松弛因子:亚松弛0<w<1;超松弛1<w<2.w=  ');
    if w == 0
        w = 1.3;
    end
    D = diag(diag(A));
    L = tril(A) - D;
    U = triu(A) - D;
    f = D + w * L;
    c0 = w * inv(f) * c;
    a0 = inv(f) * (D- w * triu(A));
    x = x0;
    x0 = x + 2 * tol;
    while max(abs(x-x0)) >= tol
        x0 = x;
        x = c0 + a0 * x0;
    end
end
if trace
    iter = iter + 1;
    fprintf('\n Iteration no. %3d\n',iter)
    fprintf('%8.6g  ',x)
end
在命令窗口输入 A=[6 2 1 -1;2 4 1 0;1 1 4 -1;-1 0 -1 3];c=[6 1 5 -5]';x0=[0 0 0 0]; diedai(A,c,x0,1,1)
错误为 Error: File: diedai.m Line: 2 Column: 29
The input character is not valid in MATLAB statements or expressions.
我有个问题  
解符号函数方程组的时候 , 如何给符号变量赋值??
求高手帮忙

TOP

希望大家一起努力,把论坛建好

TOP

说的很对,我电脑里也有很多资料没看过,希望多多交流!

TOP

支持论坛,支持math

TOP

支持楼主,辛苦了

TOP

呵呵,大家帮忙看一下,
function y = sefilter2(x, f1, f2, extmod, shift)
% SEFILTER2   2D seperable filtering with extension handling
%
%       y = sefilter2(x, f1, f2, [extmod], [shift])
%
% Input:
%   x:      input image
%   f1, f2: 1-D filters in each dimension that make up a 2D seperable filter
%   extmod: [optional] extension mode (default is 'per')
%   shift:  [optional] specify the window over which the
%               convolution occurs. By default shift = [0; 0].
%
% Output:
%   y:      filtered image of the same size as the input image:
%           Y(z1,z2) = X(z1,z2)*F1(z1)*F2(z2)*z1^shift(1)*z2^shift(2)
%
% Note:
%   The origin of the filter f is assumed to be floor(size(f)/2) + 1.
%   Amount of shift should be no more than floor((size(f)-1)/2).
%   The output image has the same size with the input image.
%
% See also: EXTEND2, EFILTER2

if ~exist('extmod', 'var')
    extmod = 'per';
end

if ~exist('shift', 'var')
    shift = [0; 0];
end

% Make sure filter in a row vector
f1 = f1(;
f2 = f2(;

% Periodized extension
lf1 = (length(f1) - 1) / 2;
lf2 = (length(f2) - 1) / 2;

y = extend2(x, floor(lf1) + shift(1), ceil(lf1) - shift(1),
    floor(lf2) + shift(2), ceil(lf2) - shift(2), extmod);

% Seperable filter
y = conv2(f1, f2, y, 'valid');
其中:shift(1)shift(2)什么意思啊?真的不明白了,也没有这样的命令啊!!求助各位帮忙解答了!!!!本人邮箱:lxnpretty@163.com

TOP

发新话题
最近访问的版块

欢迎发帖提问,对于书籍内容提问,作者给予解答

目录 样章 购买方式 目录 样章 购买方式 目录 样章 预定方式 目录 样章 预定方式