See format.
Preventing factor oursite matrix when using the disp() function.
0 comentarios
Respuestas (2)
1 comentario
Hi @David Cole,
I do agree with @Voss comments. In MATLAB, when the numbers in a matrix are very large or very small, the default display format may switch to scientific notation. To ensure that the complete numbers are displayed without this notation, you can change the display format using the format command. Specifically, using format long will allow MATLAB to display more digits and avoid scientific notation for most cases. Here is how you can modify your code to achieve the desired output:
% Define the admittance values Y11 = 1/(0.21) + 1/(0.009i); Y12 = 1/(0.0091); Y13 = 0; Y21 = 1/(0.0091); Y22 = 1/(0.0091) + 1/(0.027i); Y23 = 1/(0.0271); Y31 = 0; Y32 = 1/(0.027i); Y33 = 1/(0.21) + 1/(0.027i);
% Create the Ybus matrix Ybus = [Y11, Y12, Y13; Y21, Y22, Y23; Y31, Y32, Y33];
% Set the display format to long to avoid scientific notation format long;
% Display the Ybus matrix disp(Ybus);
Please see attached.
The admittance values are calculated using complex numbers, where i represents the imaginary unit. The matrix Ybus is constructed using the previously defined admittance values. The command format long is used to change the output format to long, which displays more digits and reduces the likelihood of scientific notation. Finally, the disp function is called to output the Ybus matrix.
Hope this helps.
0 comentarios
Ver también
Categorías
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!