I'm trying to get this plot to show me a function I can code in desmos, but is giving me the wrong plot in matlab. Any help would be appreciated
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
clc, close all, clear vars
% Pieces of the function
Q = 9.4*10^-6; % C
q = 2.4*10^-5; % C
e = 8.854*10^-12; % C^2/(Nm^2): permittivity constant
F = 0.3; % Force, newtons
R = 0.1; % radius, m
z = -0.1:0.01:0.5;
force = @(z) Q*q.*z/(2*e)*(1-z/sqrt(z.^2 + R^2))-F;
plot(z, force(z), 'g', 'LineWidth', 2);
hold on
yline(0, 'r', 'LineWidth', 2);
grid on
xlabel('Distance (m)','FontSize',14);
ylabel('Force', 'FontSize',14);
title('Force vs Distance, problem 1a')
lgd = legend({'Force/Distance', 'Force at 0.3 N'},'Fontsize', 14, 'LineWidth', 1.1);
0 Commenti
Risposta accettata
Walter Roberson
il 7 Mar 2024
clc, close all, clear vars
% Pieces of the function
Q = 9.4*10^-6; % C
q = 2.4*10^-5; % C
e = 8.854*10^-12; % C^2/(Nm^2): permittivity constant
F = 0.3; % Force, newtons
R = 0.1; % radius, m
z = -0.1:0.01:0.5;
force = @(z) Q*q.*z/(2*e).*(1-z./sqrt(z.^2 + R^2))-F;
plot(z, force(z), 'g', 'LineWidth', 2);
hold on
yline(0, 'r', 'LineWidth', 2);
grid on
xlabel('Distance (m)','FontSize',14);
ylabel('Force', 'FontSize',14);
title('Force vs Distance, problem 1a')
lgd = legend({'Force/Distance', 'Force at 0.3 N'},'Fontsize', 14, 'LineWidth', 1.1);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graph and Network Algorithms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!