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

营销型企业网站系统设置网站的默认页面

营销型企业网站系统,设置网站的默认页面,个人网站放什么内容,ui设计培训资料电磁场有限元方法EX2.2-里兹法求解泊松方程控制的边值问题 简单学习一下有限元法的基础理论,书本为电磁场有限元经典教材: THE FINITE ELEMENT METHOD IN ELECTROMAGNETICS, JIAN-MING JIN 目录 电磁场有限元方法EX2.2-里兹法求解泊松方程控制的边值问…

电磁场有限元方法EX2.2-里兹法求解泊松方程控制的边值问题

简单学习一下有限元法的基础理论,书本为电磁场有限元经典教材:
THE FINITE ELEMENT METHOD IN ELECTROMAGNETICS, JIAN-MING JIN

目录

    • 电磁场有限元方法EX2.2-里兹法求解泊松方程控制的边值问题
      • 1、问题定义
        • 1.1、英文描述
        • 1.2、中文描述
      • 2、解题
        • 2.1、解题思路
        • 2.2、Matlab代码实现
          • 2.2.1 定义试探函数和变分问题
          • 2.2.2 变分F对c1、c2变量求偏导
          • 2.2.3 F对c1、c2变量偏导为0,建立方程并求解
          • 2.2.4 对比理论解和数值解,并绘图
        • 2.3、结果对比
      • 3、全部代码
      • 4、变分公式的证明

1、问题定义

1.1、英文描述

在这里插入图片描述

1.2、中文描述

给定由波动方程定义的边值问题:

d 2 ϕ d x 2 + 2 ϕ = 0 ( 0 < x < 1 ) \frac{\mathrm{d}^{2}\phi}{\mathrm{d}x^{2}} + 2\phi = 0 \quad (0 < x < 1) dx2d2ϕ+2ϕ=0(0<x<1)

边界条件:

ϕ ∣ x = 0 = 0 和 ϕ ∣ x = 1 = 1 \left.\phi\right|_{x = 0} = 0 \quad \text{和} \quad \left.\phi\right|_{x = 1} = 1 ϕx=0=0ϕx=1=1

证明该问题的泛函 F F F为:

F ( ϕ ~ ) = 1 2 ∫ 0 1 [ ( d ϕ ~ d x ) 2 − 2 ϕ ~ 2 ] d x F(\tilde{\phi}) = \frac{1}{2} \int_{0}^{1} \left[ \left( \frac{\mathrm{d} \tilde{\phi}}{\mathrm{d} x} \right)^{2} - 2 \tilde{\phi}^{2} \right] \mathrm{d}x F(ϕ~)=2101 (dxdϕ~)22ϕ~2 dx

应用里茨方法,使用试探函数:

ϕ ~ ( x ) = x + ∑ n = 1 N c n sin ⁡ ( n π x ) ( 取  N = 2 ) \tilde{\phi}(x) = x + \sum_{n=1}^{N} c_{n} \sin(n\pi x) \quad (\text{取 } N = 2) ϕ~(x)=x+n=1Ncnsin(x)( N=2)

求近似解,并将结果与精确解:

ϕ = sin ⁡ ( 2 x ) sin ⁡ 2 \phi = \frac{\sin(\sqrt{2}\, x)}{\sin\sqrt{2}} ϕ=sin2 sin(2 x)

进行比较。

2、解题

2.1、解题思路

这题比较简单,使用经典里兹方法,将试探函数 ϕ ~ ( x ) \tilde{\phi}(x) ϕ~(x)带入泛函 F F F中,然后对泛函 F F F求c1和c2的偏导即可( F F F对c1,c2的偏导为0,以此求得极小值)。变分公式的证明见最后

下面使用matlab实现代码思路

2.2、Matlab代码实现
2.2.1 定义试探函数和变分问题

定义试探函数和变分问题,并将试探函数带入变分:

%% Solve
syms x c1 c2
% define the trail function and variational functional
phi = x+c1*sin(pi*x) +c2*sin(2*pi*x);
F=0.5*int((diff(phi, x))^2-2*(phi^2),x,0,1);
disp('F=');
pretty(simplify(F))
2.2.2 变分F对c1、c2变量求偏导
% Find the extreme value of the functional. calculate the partial derivative of c
diff_c1 = diff(F, c1);  % ∂F/∂c1
diff_c2 = diff(F, c2);  % ∂F/∂c2
2.2.3 F对c1、c2变量偏导为0,建立方程并求解
% Solve the system of equations for variables [c1, c2]
equations = [diff_c1 == 0, diff_c2 == 0];
solutions = solve(equations, [c1, c2]);
disp('Solution:');
% Extract all solutions for c1 and c2
c1_val = double(solutions.c1);
c2_val = double(solutions.c2);
% Display results (both symbolic and numeric forms)
disp(['c1 = ', num2str(c1_val)]);
disp(['c2 = ', num2str(c2_val)]);
2.2.4 对比理论解和数值解,并绘图
phi_curve=subs(phi, {c1, c2}, {c1_val, c2_val});
phi_curve_exact=sin(sqrt(2)*x)/sin(sqrt(2));%% Draw figure
figure(1)
fplot(phi_curve, [0, 1], ...'Color', [0, 0.4470, 0.7410], ... % MATLAB经典蓝'LineStyle', '--', ...             % 虚线'LineWidth', 2.5, ...'Marker', 'o', ...                 % 圆形标记'MarkerSize', 7, ...'MarkerFaceColor', 'auto', ...     % 自动填充'MarkerEdgeColor', 'k', ...        % 黑色边框'DisplayName', sprintf('Numerical: $\\phi(x) = x + %.2f\\sin(\\pi x) + %.2f\\sin(2\\pi x)$', c1_val, c2_val));hold on
fplot(phi_curve_exact, [0, 1], ...'Color', [0.8500, 0.3250, 0.0980], ... % MATLAB经典红'LineStyle', '-', ...                   % 实线'LineWidth', 2.5, ...'Marker', 's', ...                      % 正方形标记'MarkerSize', 8, ...'MarkerFaceColor', 'auto', ...           % 自动填充'DisplayName', 'Exact: $\frac{\sin(\sqrt{2} x)}{\sin(\sqrt{2})}$');xlabel('Position (x)', 'FontSize', 14);
ylabel('Function Value \phi(x)', 'FontSize', 14);
title('Comparison of Numerical and Exact Solutions', 'FontSize', 16);
xlim([0, 1]);legend('Interpreter', 'latex', 'Location', 'best', 'FontSize', 12);set(gca, 'FontSize', 12, 'GridAlpha', 0.3, 'Box', 'on');
grid minor;
2.3、结果对比

可以看到数值解和解析解是几乎一致的:
在这里插入图片描述

3、全部代码

% Exercise 2.2 THE FINITE ELEMENT METHOD IN ELECTROMAGNETICS JIN JIAN MINGclc
clear
%% Solve
syms x c1 c2
% define the trail function and variational functional
phi = x+c1*sin(pi*x) +c2*sin(2*pi*x);
F=0.5*int((diff(phi, x))^2-2*(phi^2),x,0,1);
disp('F=');
pretty(simplify(F))% Find the extreme value of the functional. calculate the partial derivative of c
diff_c1 = diff(F, c1);  % ∂F/∂c1
diff_c2 = diff(F, c2);  % ∂F/∂c2% Solve the system of equations for variables [c1, c2]
equations = [diff_c1 == 0, diff_c2 == 0];
solutions = solve(equations, [c1, c2]);
disp('Solution:');
% Extract all solutions for c1 and c2
c1_val = double(solutions.c1);
c2_val = double(solutions.c2);
% Display results (both symbolic and numeric forms)
disp(['c1 = ', num2str(c1_val)]);
disp(['c2 = ', num2str(c2_val)]);phi_curve=subs(phi, {c1, c2}, {c1_val, c2_val});
phi_curve_exact=sin(sqrt(2)*x)/sin(sqrt(2));%% Draw figure
figure(1)
fplot(phi_curve, [0, 1], ...'Color', [0, 0.4470, 0.7410], ... % MATLAB经典蓝'LineStyle', '--', ...             % 虚线'LineWidth', 2.5, ...'Marker', 'o', ...                 % 圆形标记'MarkerSize', 7, ...'MarkerFaceColor', 'auto', ...     % 自动填充'MarkerEdgeColor', 'k', ...        % 黑色边框'DisplayName', sprintf('Numerical: $\\phi(x) = x + %.2f\\sin(\\pi x) + %.2f\\sin(2\\pi x)$', c1_val, c2_val));hold on
fplot(phi_curve_exact, [0, 1], ...'Color', [0.8500, 0.3250, 0.0980], ... % MATLAB经典红'LineStyle', '-', ...                   % 实线'LineWidth', 2.5, ...'Marker', 's', ...                      % 正方形标记'MarkerSize', 8, ...'MarkerFaceColor', 'auto', ...           % 自动填充'DisplayName', 'Exact: $\frac{\sin(\sqrt{2} x)}{\sin(\sqrt{2})}$');xlabel('Position (x)', 'FontSize', 14);
ylabel('Function Value \phi(x)', 'FontSize', 14);
title('Comparison of Numerical and Exact Solutions', 'FontSize', 16);
xlim([0, 1]);legend('Interpreter', 'latex', 'Location', 'best', 'FontSize', 12);set(gca, 'FontSize', 12, 'GridAlpha', 0.3, 'Box', 'on');
grid minor;

4、变分公式的证明

在这里插入图片描述


文章转载自:

http://LYTTWKSg.bpddc.cn
http://DsQ28n2L.bpddc.cn
http://tlzlCyYg.bpddc.cn
http://bHqOthui.bpddc.cn
http://47HmTsnP.bpddc.cn
http://BUXl39DL.bpddc.cn
http://3EwUzdQs.bpddc.cn
http://NlO5HNc5.bpddc.cn
http://cbXIYjDh.bpddc.cn
http://5vrt4VVp.bpddc.cn
http://fshKGN6n.bpddc.cn
http://WYG1ALRH.bpddc.cn
http://jU6XgYQr.bpddc.cn
http://BjhUGNwT.bpddc.cn
http://093vDcV8.bpddc.cn
http://I5eklftV.bpddc.cn
http://lwXfAxhi.bpddc.cn
http://x2Pv42wU.bpddc.cn
http://YnUOqGMU.bpddc.cn
http://TjSbmPes.bpddc.cn
http://47ThgDqr.bpddc.cn
http://XfH76MmI.bpddc.cn
http://4XHVsmLP.bpddc.cn
http://ACFF8EDr.bpddc.cn
http://LDEInqfu.bpddc.cn
http://YAmyooUz.bpddc.cn
http://u0gzaElU.bpddc.cn
http://5ufxaCQg.bpddc.cn
http://aPkkYaMU.bpddc.cn
http://IjmduoYs.bpddc.cn
http://www.dtcms.com/wzjs/665581.html

相关文章:

  • 网站开发公司哪家好wordpress添加点赞
  • 衡水哪儿做网站便宜网站建设怎么设置渐变色
  • 论坛型网站开发本厂有大量手工活外发
  • 网站seo系统如何建立公司网站意味着什么
  • 确定网站建设目的sem营销推广
  • 佛山响应式网站开发销售网站建设怎么做
  • 北京建设工程质量总站网站瑞金网站建设推广
  • 做soho外贸网站潍坊百度关键词排名
  • 学校网站建设工作音乐推广平台有哪些
  • 上海哪家公司提供专业的网站建设网站建设 app开发
  • 手机响应式网站建设库平台
  • dedecms做图库网站如何同步wordpress
  • 勒流有做网站的吗网站详情页用什么软件做
  • 有新浪的域名怎么做网站phpcms v9网站建设入门
  • 新塘17网站一起做网店官网湖南网络大课堂
  • php网站助手做网站需要几天
  • wordpress 特色缩略图wordpress platinum seo 插件
  • 好看的美食怎么做视频网站怎样做网站呢 优帮云
  • 深圳 SEO 网站建设 哪里学沭阳哪里可以做网站
  • 重庆网站制作外包公司wordpress 自建图床
  • 做马来西亚生意的网站wordpress 删除角色
  • 如何通过网站做网上报名系统dede无法一键更新网站
  • 最好的网站建设公司哪家好网页设计师培训大全
  • 福州建设注册中心网站网站建设公司高端
  • 怎样设计网站静态页面网页设计与制作属于什么专业
  • 江都网络建站企业外包
  • 网站开发服务计入什么科目网站更换程序
  • 密云做网站的网络营销价格策略有哪些
  • 成都私人做网站建设的公司建设银行集团网站
  • 青岛网站建设工作室织梦模板wordpress建站多少钱