6.4.4 Testlashga mashq
Keling, sinov misolini ko'rib chiqaylik
Aniq yechim
Matlab kodining namunasi quyida keltirilgan:
clear all; close all; % Clear every thing so it won't mess up
% with other existing variables.
%%%%%% Generate a mesh.
x(1)=0; x(2)=0.1; x(3)=0.3; x(4)=0.333; x(5)=0.5; x(6)=0.75;x(7)=1;
U = fem1d(x);
%%%%%% Compare errors:
x2 = 0:0.05:1; k2 = length(x2);
for i=1:k2,
u_exact(i) = soln(x2(i));
u_fem(i) = fem_soln(x,U,x2(i)); % Compute FE solution at x2(i)
end
error = norm(u_fem-u_exact,inf) % Compute the infinity error
plot(x2,u_fem,':', x2,u_exact) % Solid: the exact,
% dotted: FE solution
hold; plot(x,U,'o') % Mark the solution at nodal
% points
xlabel('x'); ylabel('u(x) & u_{fem}(x)');
title('Solid line: Exact solution, Dotted line: FE solution')
figure(2); plot(x2,u_fem-u_exact); title('Error plot')
xlabel('x'); ylabel('u-u_{fem}'); title('Error Plot')
6.4 -rasmda kodni ishga tushirish orqali ishlab chiqarilgan grafiklar ko'rsatilgan. 6.4 (a) -rasmda ham aniq yechim (qattiq chiziq), ham chekli element yechimi (uzuq chiziq) ko'rsatilgan. Kichik "o" lar tugun nuqtalaridagi chekli element yechimlari qiymatlari. 6.4 - (b) rasmda bir nechta tanlangan nuqtalarda aniq va chekli element yechimlari orasidagi xatolik ko'rsatilgan (bu misolda tugun nuqtalarida nol, garchi umuman bunday bo'lmasa ham).
6.4 -(a) rasm. Aniq yechim (qattiq chiziq) va chekli elementli yechim (uzuq chiziq) va (b) ba'zi tanlangan nuqtalarda xatolik chizig'i.
Topshiriqlar
Quyidagi ChQM ni muhokama qilamiz:
Kuchsiz forma (variatsion shakl) ekanligini ko'rsating
bu yerda
Chekli element yaqinlashuvi uchun tenglamalarning chiziqli sistemasini chiqaring
quyidagi ma’lumotlar bilan
basis funksiyalar bu chapkacha funksiyalari
va tugun nuqtalari va elementlarining tartibini o'zgartirmang; va
qattiqlik matritsasini va yuklanish vektor elementini elementlar bo'yicha yig'ing.
(Bu masala drive.m, f.m va soln.m. ni o'zgartirishni o'z ichiga oladi) Yechish uchun Matlab kodidan foydalaning
Ikki xil to`rni sinab ko'ring: (a) drive.m da berilgan; (b) tekis to'r xi = ih, h = 1/M, i = 0, 1,. . . , M. Matlabda bajarilganda M = 10 ni oling: x= 0: 0.1: 1.
Quyidagi f(x) yoki aniq u(x) uchun masalani yechish uchun ikkita to`rdan foydalaning:
u(x) = sin(πx) berilgan, f(x)-?
given f(x) = x3, u(x)-?
(qo'shimcha ball) berilgan f (x) = δ (x -1/2), bu erda δ (x) - Dirac delta funktsiyasi, u (x) nima?
Do'stlaringiz bilan baham: |