All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
clear all close all clc %%Defining the Mesh n_points = 5 ; % Total number of points dom_size = 1; % Size of the Domain h = dom_size/(n_points - 1); % Space between each grid % Initializing the Problem y(1) = 0; y(n_points) = 1; y_new(1) = 0; y_new(n_points) = 1; error_mag = 1; error_req = 1e-7; iterations = 0; %%Calculations…
Amith Ganta
updated on 22 May 2021
clear all
close all
clc
%%Defining the Mesh
n_points = 5 ; % Total number of points
dom_size = 1; % Size of the Domain
h = dom_size/(n_points - 1); % Space between each grid
% Initializing the Problem
y(1) = 0;
y(n_points) = 1;
y_new(1) = 0;
y_new(n_points) = 1;
error_mag = 1;
error_req = 1e-7;
iterations = 0;
%%Calculations
while error_mag > error_req
for i = 2:(n_points - 1);
y_new(i) = 0.5 .*(y(i-1) + y(i+1));
iterations = iterations +1;
end
% calculation of error magnitude
error_mag = 0;
for i = 2:(n_points - 1)
error_mag = error_mag + abs(y(i) - y_new(i));
end
% Assigning new to the old
y = y_new;
end
%Plotting
x_dom = ((1:n_points)-1).*h;
figure;
plot(x_dom,y)
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Quater car modelling using Matlab
Quarter Car model …
25 Sep 2023 03:07 PM IST
Pacjeka combined slip
Pacjeka Magic Tyre model Pacjeka Magic Tyre model was developed by Prof.Hans Bastiaan Pacejka and it is widely used to represent empirically and interpolate previously measured…
05 Jun 2023 02:04 PM IST
Longitudinal and Lateral brush tyre model using Matlab
Tyre Modeling A tyre model is a mathematical or an empirical representation of the mechanism…
16 May 2023 07:14 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.