Inductance of a Transmission Line
4 views (last 30 days)
Show older comments
Sophia Bonifant
on 26 Mar 2021
Commented: Star Strider
on 26 Mar 2021
So, I'm supposed to create a function to calculate the total inductance when given the variables. This is what I have so far:
% Script file: myinductance.m
%
% Purpose:
% This program calculates the total inductance of a transmission line as
% a function of its length in kilometers, the spacing between the two
% conductors, and the diameter of each conductor.
% Known variables:
% D is the distance bewtween two conductors = 1.5 m
% r is the radius of each conductor = 2 cm
% Constant for permeability of free space:
mu0 = {4.*pi.*1e-7};
% The function of the inductance per meter of a single-phase two-wire
% transmission line is:
function inductance = myind(D, r, mu0)
inductance = (mu0./pi).*((1./4)+log(D./r));
end
It's not recognizing the name of the function (the "myind") and I'm not even sure where to go from here. ://
This is exercise 6.10 (p. 276) in "The Essentials of Matlab Programming" - Stephen J. Chapman.
2 Comments
Accepted Answer
Star Strider
on 26 Mar 2021
The error I get is:
Operator './' is not supported for operands of type 'cell'.
because of:
mu0 = {4.*pi.*1e-7};
Since there is no need to create it as a cell array, removing the curly braces:
mu0 = 4.*pi.*1e-7;
and running:
% Script file: myinductance.m
%
% Purpose:
% This program calculates the total inductance of a transmission line as
% a function of its length in kilometers, the spacing between the two
% conductors, and the diameter of each conductor.
% Known variables:
% D is the distance bewtween two conductors = 1.5 m
% r is the radius of each conductor = 2 cm
% Constant for permeability of free space:
mu0 = 4.*pi.*1e-7;
% The function of the inductance per meter of a single-phase two-wire
% transmission line is:
Inductance = myind (1.5, 2, mu0)
function inductance = myind(D, r, mu0)
inductance = (mu0./pi).*((1./4)+log(D./r));
end
from the Command Window after saving it to my MATLAB path as ‘myinductance.m’ produces:
Inductance =
-15.0728e-009
since in R2020a (and several previous releases/versions), functions at the end of script files are allowed.
Problem solved?
.
2 Comments
Star Strider
on 26 Mar 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!