当前位置: 首页 > news >正文

怀安网站建设郑州抖音推广

怀安网站建设,郑州抖音推广,徐州做外贸网站,怎么免费建公司网站给出线性方程组 Hn*x b,其中系数矩阵Hn为希尔伯特矩阵: 假设 x ∗ (1, 1, . . . , 1)T,b Hnx ∗。若取 n 6,8, 10,分别用 Jacobi 迭代法及 SOR迭代(ω 1, 1:25,1:5)求解,比较计算结果。…

给出线性方程组 Hn*x = b,其中系数矩阵Hn为希尔伯特矩阵:     

假设 x ∗ =(1, 1, . . . , 1)T,b = Hnx ∗。若取 n = 6,8, 10,分别用 Jacobi

迭代法及 SOR迭代(ω = 1, 1:25,1:5)求解,比较计算结果。

MATLAB源码如下,运行Demo_Jacobi_SOR.m文件,附件包含另外两个函数文件,分别为:Jacobi.m与SOR.m。

Demo_Jacobi_SOR.m

clear all

clc

n=[6 8 10];

for i=1:length(n)

H{i}=hilb(n(i));

size_H{i}=size(H{i},1);

x_true{i}=ones(1,size_H{i});

b{i}=x_true{i}*H{i};

x_ini{i}=zeros(1,size_H{i});

%accuracy=5*(10^-6);

accuracy=0.01;

end

%Jacobi

disp('Jacobi');

for i=1:length(n)

    fprintf('The dimension is %d\n',n(i))

    [x{i},k{i}]=Jacobi(H{i},b{i},x_ini{i},accuracy,x_true{i});

end

%SOR

disp('SOR');

w=1;

disp('SOR w=1');

for i=1:length(n)

    fprintf('The dimension is %d\n',n(i))

    [q{i},e{i}]=SOR(H{i},b{i},x_ini{i},accuracy,x_true{i},w);

end

w=1.25;

disp('SOR w=1.25');

for i=1:length(n)

    fprintf('The dimension is %d\n',n(i))

    [z{i},x{i}]=SOR(H{i},b{i},x_ini{i},accuracy,x_true{i},w);

end

w=1.5;

disp('SOR w=1.5');

for i=1:length(n)

    fprintf('The dimension is %d\n',n(i))

    [v{i},b{i}]=SOR(H{i},b{i},x_ini{i},accuracy,x_true{i},w);

end

%[x,k]=Jacobi(A,b,x_ini,accuracy,x_true);

Jacobi.m

function [x,k]=Jacobi(A,b,x_ini,accuracy,x_true)

% input:  A—Left Matrix

%         b—Right Matrix

%         x_ini—initial value

%         accuracy—calculation precision between solution and true value

%         x_true—true valuer

% output: x—solution

%         k—iteration-1

n=size(A,1);

uint16 k;

k=1;

x{1}=x_ini;

    while(norm(x_true-x{k},Inf)>=accuracy)

        k=k+1;

        %disp(k-1);

        for i=1:1:n

            temp1=0;

            for j=1:1:i-1

              temp1=temp1+A(i,j)*x{k-1}(j);

            end

            temp2=0;

            for j=i+1:1:n

                temp2=temp2+A(i,j)*x{k-1}(j);

            end

            x{k}(i)=(b(i)-temp1-temp2)/A(i,i);

        end

        if (k==200000)

           break;

        end

    end

  fprintf('The iteration k=%d\n',k-1);

  disp('The solution is');

  disp(x{k});

  end

SOR.m

function [x,k]=SOR(A,b,x_ini,accuracy,x_true,w)

% input:  A—Left Matrix

%         b—Right Matrix

%         x_ini—initial value

%         accuracy—calculation precision between solution and true value

%         x_true—true value

%         w—relaxation factor

% output: x—solution

%         k—iteration-1

n=size(A,1);

uint16 k;

k=1;

x{1}=x_ini;

    while(norm(x_true-x{k},Inf)>accuracy)

        k=k+1;   

        %disp(k-1);

        for i=1:1:n

            temp1=0;

            if(i>1)

                for j=1:1:i-1

                    temp1=temp1+A(i,j)*x{k}(j);

                end

            end

            temp2=0;

            for j=i:1:n

                temp2=temp2+A(i,j)*x{k-1}(j);

            end

            x{k}(i)=x{k-1}(i)+w*(b(i)-temp1-temp2)/A(i,i);

        end

        if (k==200000)

           break;

        end    

    end

    

  fprintf('The iteration k=%d\n',k-1);

  disp('The solution is');

  disp(x{k});

  end

MATLAB运行结果为:

Jacobi

The dimension is 6

The iteration k=199999

The solution is

  Inf   Inf   Inf  Inf   Inf   Inf

The dimension is 8

The iteration k=199999

The solution is

  Inf   Inf   Inf  Inf   Inf   Inf  Inf   Inf

The dimension is 10

The iteration k=199999

The solution is

  Inf   Inf   Inf  Inf   Inf   Inf  Inf   Inf   Inf  Inf

SOR

SOR w=1

The dimension is 6

The iteration k=14508

The solution is

   0.9999    1.0016    0.9957   0.9994    1.0100    0.9933

The dimension is 8

The iteration k=42694

The solution is

   1.0001    0.9984    1.0076   0.9900    0.9971    1.0073   1.0068    0.9926

The dimension is 10

The iteration k=25508

The solution is

   1.0001    0.9980    1.0065   0.9985    0.9912    0.9970   1.0057    1.0091    1.0039   0.9900

SOR w=1.25

The dimension is 6

The iteration k=82840

The solution is

   1.0000    0.9995    1.0036   0.9908    1.0100    0.9961

The dimension is 8

The iteration k=50752

The solution is

   1.0001    0.9984    1.0073   0.9900    0.9983    1.0064   1.0060    0.9934

The dimension is 10

The iteration k=26267

The solution is

   1.0001    0.9983    1.0048   1.0012    0.9900    0.9971   1.0053    1.0087    1.0038   0.9906

SOR w=1.5

The dimension is 6

The iteration k=174587

The solution is

   1.0000    0.9994    1.0036   0.9908    1.0100    0.9961

The dimension is 8

The iteration k=52211

The solution is

   1.0001    0.9985    1.0071   0.9900    0.9996    1.0049   1.0059    0.9939

The dimension is 10

The iteration k=199999

The solution is

   1.0000    1.0007    0.9954   1.0113    0.9909    0.9986   0.9993    1.0049    1.0026   0.9962

运行结果分析:

          用雅克比迭代法进行线性方程系数矩阵为希尔伯特矩阵的求解,解是发散的,最终趋于无穷大。

         用SOR迭代法进行线性方程系数矩阵为希尔伯特矩阵的求解,解是收敛的,且收敛速度与矩阵的大小有关,但不是单调性的正相关或者负相关关系。

http://www.mmbaike.com/news/58847.html

相关文章:

  • 个人做商机网站如何盈利网络推广外包流程
  • 嘉兴做网站建设的公司哪家好搜索引擎推广步骤
  • 枣强网址建站seo站长助手
  • 网站片头动画用什么软件做的谷歌应用商店下载
  • 集团网站策划方案seo快速排名软件网站
  • 政府网站建设如何做外包公司
  • 西安seo服务推广资源seo
  • 如何制作网站导航栏关键词挖掘长尾词
  • 如何将自己做的网站放到网上小说关键词搜索器
  • 网站手机版管理链接域名交易中心
  • wordpress图片设置水印广州seo外包
  • 2023中央农村工作会议关键词优化方法有什么步骤
  • 做网站的公司 杭州大一html网页制作作业
  • 内部劵网站怎么做seo搜索引擎优化是
  • 免费做手机网站建设百度新闻官网首页
  • 做旅游网站平台合作入驻网站开发用什么语言
  • 网站建设的专业知识今日国际新闻头条新闻
  • 大理企业网站建设推广普通话的手抄报
  • 阜新网站建设企业网站seo点击软件
  • 个人网站如果做google官网下载安装
  • 如何获取网站访客qq网站推广方式有哪些
  • 软件公司市值排名如何做seo搜索优化
  • 浅析b2c电子商务网站的建设免费建一个自己的网站
  • 做网站如何买量seo课程
  • 做名片最好的网站seo外包推广
  • 如何做网站在网上销售疫情最新情况
  • php网站开发进程状态微博指数查询
  • 简述网站推广的五要素网络自动推广软件
  • php自建网站关键词搜索技巧
  • 政府网站建设未来发展方向汕头seo服务