%r is r1 33 r2 47 = 80
% xl1 is 60 ohms xl 2 is 30 = 90
%z = sqrt(r^2 + xl^2)
%theta = atan2d(xl/r)
%ohms law i = v / z
v = input('volts:');
r = input ('resistance:');
i = current;
xl = input ('impedance:');
theta = atan2d (xl/r);
z = sqrt(r^2 + xl^2);
i = v / z;
disp ([' current is ' num2str(i) ' impedance is ' num2str(xl)']);

답변 (1개)

KSSV
KSSV 2020년 9월 26일
편집: KSSV 2020년 9월 26일

0 개 추천

You have to use Ohm's law instead of the unknown variable current.
Use fprintf instead disp.
%r is r1 33 r2 47 = 80
% xl1 is 60 ohms xl 2 is 30 = 90
%z = sqrt(r^2 + xl^2)
%theta = atan2d(xl/r)
%ohms law i = v / z
v = input('volts:');
r = input ('resistance:');
i = v/r ;
xl = input ('impedance:');
theta = atan(xl/r);
z = sqrt(r^2 + xl^2);
i = v / z;
fprintf ('current is: %f, impedance is %f\n', i,xl);

댓글 수: 3

I got rid of the i = current
I'll try that f print function
i use atan2d since its in degrees.
correct me if i'm wrong in any of this.
I ended up doing this:
%volts is 120V
%r is r1 33 r2 47 = 80
% xl1 is 60 ohms xl 2 is 30 = 90
%z = sqrt(r^2 + xl^2)
%theta = atan2d(xl/r)
%ohms law i = v / z
v = input('volts:');
r = input ('resistance:');
xl = input ('impedance:');
theta = atan2d (xl,r);
z = sqrt(r^2 + xl^2);
i = v / z;
disp ([' current is ' num2str(i) ' amps' ' impedance is ' num2str(z) ' deg ' num2str(theta)]);
KSSV
KSSV 2020년 9월 27일
Read about atand.
Jorge Rodriguez
Jorge Rodriguez 2020년 9월 27일
Already did. thanks

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

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

질문:

2020년 9월 26일

댓글:

2020년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by