Write a MATLAB program to plot the following: a. The magnitude of the electric field along the central axis of a uniformly charged circular ring of radium 1 m and charge density 1 C/m. Assume that the ring is centred around the Z –axis.

조회 수: 2 (최근 30일)
Is my code is correct?
Code:
lambda = 1;
R = 1;
k = 9e9;
n = input('Enter the value of z:');
z = -n:1:n;
E = ((2*pi*k*lambda*R*z)./((R.^2+z.^2).^1.5));
plot(z,E)
title("Electric Field Along z-axis");
xlabel('z-axis (in metres)');
ylabel('E-field (in N/C)');
  댓글 수: 2
Rik
Rik 2020년 2월 24일
This time I edited your question for you. Next time, please use the tools explained on this page to make your question more readable.
You can find guidelines for posting homework on this forum here.
David Goodmanson
David Goodmanson 2020년 2월 25일
Hi Sai,
the code looks good although I would say that points are inexpensive so -n : .01 : n looks much better. 'grid on' at the very end looks even better.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by