I having trouble with functions
Show older comments
I'm having trouble with my function working with an electrical field problem:

I have my code inserted below, but don't seem to understand how to do the second half of the problem by. Any help would be great. Thank You.
Main Code:
Q = linspace(1,12,12); %sec
r = linspace(0.05,0.6,12); %meter
Q = linspace(1,14,14); %sec
r = linspace(0.76,0.89,14); %meter
Q_t1 = linspace(1.3,1.5,12);
Q_t2 = linspace(1.3,1.7,14); %This is for the second half
[E] = E_sphere(r, Q);
%[E] = E_sphere(r, Q); %This is for the second half
subplot(1,2,1)
plot(E,Q_t1)
subplot(1,2,2)
plot(E,Q_t2)
Function Code:
function [E] = E_sphere(r,Q)
e_o = 8.85e-12; %F/m
E = (Q)/4.*pi.*e_o.*r.*(Q).^2;
end
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!