kernel_for_inverse_heat_conduction.m

来自「Defines and Computes the Differentiation」· M 代码 · 共 35 行

M
35
字号
%Defines and Computes the Differentiation Kernel, the kernel of the inverse
%heat conduction problem as a function of s and r.  Note: you will need to 
%select some value Nmax at which to terminate the infinite sums in SVE of 
%the kernel

clc
clear all
close all

%an array of Nmax values
set_of_Nmax = [1 3 5 10 15 20 30 40 100];

%evaluate for T = 0.1 and T = 3
for T = 0.1:2.9:3,
    figure();
    %evaluate for each value of Nmax
    for loop = 1:length(set_of_Nmax),
        Nmax = set_of_Nmax(loop);
        [s,r] = meshgrid(0:.01:pi);

        K = 0;
        for i = 1:Nmax,
            %defines the kernel
            K = K + (2/pi)*exp(-i^2*T)*sin(i*s).*sin(i*r);
        end
        
        %plots the results
        subplot(ceil(sqrt(length(set_of_Nmax))),ceil(sqrt(length(set_of_Nmax))),loop); mesh(s,r,K);
        xlabel('s');
        ylabel('r');
        zlabel('kernel');
        title(['Nmax = ' num2str(Nmax) ' and T = ' num2str(T)]);
    end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?