Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/I am trying to plot a graph using mathematical formulas.

I am trying to plot a graph using mathematical formulas.

PuTI / 2025-02-25
I am trying to plot a graph using mathematical formulas.
Matlab News

Hello everyone, I am trying to obtain the following graph using the explanations below, but I am getting a different result. I would really appreciate it if you could help me find the error.
explanations:

my code:
clear all
clc

% Parameters
epsilon0 = 8.85e-12;
epsilon_m = 79;
CM = 0.5;
k_B = 1.38e-23;
R = 1e-6;
gamma = 1.88e-8;
q = 1e-14;
dt = 1e-3;
T = 300;
x0 = 10e-6;
num_steps = 1000;
N = 100000;

epsilon = 1e-9;
k = 1 / (4 * pi * epsilon_m);

% **Creating matrices to store FDEP force and positions**
x_dep = zeros(num_steps, N);
x_diff = zeros(num_steps, N);
FDEP = zeros(num_steps, N);

% **Initial Positions**
x_dep(1, 🙂 = x0;
x_diff(1, 🙂 = x0;

% **Generating random numbers for Brownian motion**
rng(0);

% **Loop for 100,000 Simulations (Each Simulation Runs Independently!)**
for sim = 1:N
% **Generate random Gaussian noise for each particle**
W = randn(num_steps, 1);

for i = 1:num_steps-1
% **Calculate FDEP separately for each particle**
FDEP(i, sim) = 4 * pi * R^3 * epsilon0 * epsilon_m * CM * (-2 * k^2 * q^2) / ((abs(x_dep(i, sim) – x0) + epsilon)^5);

% **Motion under the effect of FDEP (Used for Correct Simulation)**
x_dep(i+1, sim) = x_dep(i, sim) + (FDEP(i, sim) / gamma) * dt + sqrt(2 * k_B * T / gamma) * sqrt(dt) * W(i);

% **Pure diffusion (without DEP force)**
x_diff(i+1, sim) = x_diff(i, sim) + sqrt(2 * k_B * T / gamma) * sqrt(dt) * W(i);
end
end

% **Calculate Mean Positions**
x_mean_dep = mean(x_dep, 2);
x_mean_diff = mean(x_diff, 2);

% **Plot the Graph**
figure;
plot((0:num_steps-1) * dt, x_mean_dep * 1e6, ‘b’, ‘LineWidth’, 1.5);
hold on;
plot((0:num_steps-1) * dt, x_mean_diff * 1e6, ‘r–‘, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’);
ylabel(‘Position (μm)’);
title(‘Particle Motion Under the Effect of Dielectrophoretic Force’);
legend(‘Diffusion under F_{DEP}’, ‘Pure diffusion’);
grid on;
hold off;Hello everyone, I am trying to obtain the following graph using the explanations below, but I am getting a different result. I would really appreciate it if you could help me find the error.
explanations:

my code:
clear all
clc

% Parameters
epsilon0 = 8.85e-12;
epsilon_m = 79;
CM = 0.5;
k_B = 1.38e-23;
R = 1e-6;
gamma = 1.88e-8;
q = 1e-14;
dt = 1e-3;
T = 300;
x0 = 10e-6;
num_steps = 1000;
N = 100000;

epsilon = 1e-9;
k = 1 / (4 * pi * epsilon_m);

% **Creating matrices to store FDEP force and positions**
x_dep = zeros(num_steps, N);
x_diff = zeros(num_steps, N);
FDEP = zeros(num_steps, N);

% **Initial Positions**
x_dep(1, 🙂 = x0;
x_diff(1, 🙂 = x0;

% **Generating random numbers for Brownian motion**
rng(0);

% **Loop for 100,000 Simulations (Each Simulation Runs Independently!)**
for sim = 1:N
% **Generate random Gaussian noise for each particle**
W = randn(num_steps, 1);

for i = 1:num_steps-1
% **Calculate FDEP separately for each particle**
FDEP(i, sim) = 4 * pi * R^3 * epsilon0 * epsilon_m * CM * (-2 * k^2 * q^2) / ((abs(x_dep(i, sim) – x0) + epsilon)^5);

% **Motion under the effect of FDEP (Used for Correct Simulation)**
x_dep(i+1, sim) = x_dep(i, sim) + (FDEP(i, sim) / gamma) * dt + sqrt(2 * k_B * T / gamma) * sqrt(dt) * W(i);

% **Pure diffusion (without DEP force)**
x_diff(i+1, sim) = x_diff(i, sim) + sqrt(2 * k_B * T / gamma) * sqrt(dt) * W(i);
end
end

% **Calculate Mean Positions**
x_mean_dep = mean(x_dep, 2);
x_mean_diff = mean(x_diff, 2);

% **Plot the Graph**
figure;
plot((0:num_steps-1) * dt, x_mean_dep * 1e6, ‘b’, ‘LineWidth’, 1.5);
hold on;
plot((0:num_steps-1) * dt, x_mean_diff * 1e6, ‘r–‘, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’);
ylabel(‘Position (μm)’);
title(‘Particle Motion Under the Effect of Dielectrophoretic Force’);
legend(‘Diffusion under F_{DEP}’, ‘Pure diffusion’);
grid on;
hold off; Hello everyone, I am trying to obtain the following graph using the explanations below, but I am getting a different result. I would really appreciate it if you could help me find the error.
explanations:

my code:
clear all
clc

% Parameters
epsilon0 = 8.85e-12;
epsilon_m = 79;
CM = 0.5;
k_B = 1.38e-23;
R = 1e-6;
gamma = 1.88e-8;
q = 1e-14;
dt = 1e-3;
T = 300;
x0 = 10e-6;
num_steps = 1000;
N = 100000;

epsilon = 1e-9;
k = 1 / (4 * pi * epsilon_m);

% **Creating matrices to store FDEP force and positions**
x_dep = zeros(num_steps, N);
x_diff = zeros(num_steps, N);
FDEP = zeros(num_steps, N);

% **Initial Positions**
x_dep(1, 🙂 = x0;
x_diff(1, 🙂 = x0;

% **Generating random numbers for Brownian motion**
rng(0);

% **Loop for 100,000 Simulations (Each Simulation Runs Independently!)**
for sim = 1:N
% **Generate random Gaussian noise for each particle**
W = randn(num_steps, 1);

for i = 1:num_steps-1
% **Calculate FDEP separately for each particle**
FDEP(i, sim) = 4 * pi * R^3 * epsilon0 * epsilon_m * CM * (-2 * k^2 * q^2) / ((abs(x_dep(i, sim) – x0) + epsilon)^5);

% **Motion under the effect of FDEP (Used for Correct Simulation)**
x_dep(i+1, sim) = x_dep(i, sim) + (FDEP(i, sim) / gamma) * dt + sqrt(2 * k_B * T / gamma) * sqrt(dt) * W(i);

% **Pure diffusion (without DEP force)**
x_diff(i+1, sim) = x_diff(i, sim) + sqrt(2 * k_B * T / gamma) * sqrt(dt) * W(i);
end
end

% **Calculate Mean Positions**
x_mean_dep = mean(x_dep, 2);
x_mean_diff = mean(x_diff, 2);

% **Plot the Graph**
figure;
plot((0:num_steps-1) * dt, x_mean_dep * 1e6, ‘b’, ‘LineWidth’, 1.5);
hold on;
plot((0:num_steps-1) * dt, x_mean_diff * 1e6, ‘r–‘, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’);
ylabel(‘Position (μm)’);
title(‘Particle Motion Under the Effect of Dielectrophoretic Force’);
legend(‘Diffusion under F_{DEP}’, ‘Pure diffusion’);
grid on;
hold off; mathematics, signal processing, signal, graph, graphics, matrices, matlab, differential equations MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

Issue with imdistline() function in MATLAB?
2025-05-11

Issue with imdistline() function in MATLAB?

XCP internal error in arduino uno
2025-05-11

XCP internal error in arduino uno

Ansys Motion to Simulink Interface Problem
2025-05-11

Ansys Motion to Simulink Interface Problem

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss