get an 6 input from users 3 voltage phasors and 3 current phasors in matlab

To get 6 inputs from the user for 3 voltage phasors and 3 current phasors in MATLAB, you can use the input function to prompt the user for individual real and imaginary parts of each phasor.

Here's an example code snippet that shows how you can implement this:

main.m
% Prompt the user for voltage phasors
disp('Enter the real and imaginary parts for each voltage phasor:')
V = zeros(3, 1);  % Initialize an empty array to store the voltage phasors
for i = 1:3
    realPart = input(['Voltage Phasor ', num2str(i), ' - Real Part: ']);
    imagPart = input(['Voltage Phasor ', num2str(i), ' - Imaginary Part: ']);
    V(i) = complex(realPart, imagPart);
end

% Prompt the user for current phasors
disp('Enter the real and imaginary parts for each current phasor:')
I = zeros(3, 1);  % Initialize an empty array to store the current phasors
for i = 1:3
    realPart = input(['Current Phasor ', num2str(i), ' - Real Part: ']);
    imagPart = input(['Current Phasor ', num2str(i), ' - Imaginary Part: ']);
    I(i) = complex(realPart, imagPart);
end

% Display the entered values
disp('Entered voltage phasors:')
disp(V)
disp('Entered current phasors:')
disp(I)
889 chars
24 lines

This code will prompt the user to enter the real and imaginary parts for each voltage and current phasor. It uses a loop to iterate through each phasor and store them in separate arrays V and I. Finally, it displays the entered phasor values.

Make sure to check the order of phasors input as per your requirements and adjust the code accordingly.

Note: The above code assumes that the user will enter valid numeric inputs for the real and imaginary parts of each phasor.

gistlibby LogSnag