I having trouble with functions
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!