rom the following code make me a very nice company type interface describing an electrical machine company the code is from matlab :

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

from the following code make me a very nice company type interface describing an electrical machine company the code is from matlab :

function magneticFieldGUI
    % Create the main figure
    fig = uifigure('Name', 'Magnetic Field', 'Position', [100, 100, 800, 600]);

    % Frequency and angle sliders
    freqSlider = uislider(fig, 'Limits', [1 100], 'Value', 50, 'Position', [50 450 200 3]);
    angleSlider = uislider(fig, 'Limits', [0 360], 'Value', 45, 'Position', [50 350 200 3]);

    % Create labels for the sliders
    freqLabel = uilabel(fig, 'Text', 'Frequency (Hz)', 'Position', [50 480 150 22]);
    angleLabel = uilabel(fig, 'Text', 'Angle °', 'Position', [50 380 150 22]);

    % Update button
    updateButton = uibutton(fig, 'Text', 'Update Plots', 'Position', [170 230 150 30]);
    updateButton.ButtonPushedFcn = @updatePlots;

    axes1 = uiaxes(fig, 'Position', [300 100 400 300]);
    axes2 = uiaxes(fig, 'Position', [300 400 400 150]);

    function updatePlots(~, ~)
        freq = freqSlider.Value;
        angle_deg = angleSlider.Value;
        angle_rad = deg2rad(angle_deg);
        T = 1 / freq;
        w = 2 * pi * freq;
        n = 2;
        t = 0:T/1200:n*T;

        Baa = sin(w*t + angle_rad) .* (cos(0) + 1i*sin(0));
        Bbb = sin(w*t - 2*pi/3 + angle_rad) .* (cos(2*pi/3) + 1i*sin(2*pi/3));
        Bcc = sin(w*t + 2*pi/3 + angle_rad) .* (cos(-2*pi/3) + 1i*sin(-2*pi/3));

        Bnet = Baa + Bbb + Bcc;

        cla(axes1);
        cla(axes2);

        plot(axes1, real(Bnet), imag(Bnet), 'r');
        hold(axes1, 'on');
        plot(axes1, real(Baa), imag(Baa), 'c');
        plot(axes1, real(Bbb), imag(Bbb), 'b');
        plot(axes1, real(Bcc), imag(Bcc), 'm');
        hold(axes1, 'off');
        axis(axes1, 'equal');

        plot(axes2, t, real(Baa), 'c');
        hold(axes2, 'on');
        plot(axes2, t, real(Bbb), 'b');
        plot(axes2, t, real(Bcc), 'm');
        plot(axes2, t, real(Bnet), 'r');
        hold(axes2, 'off');
        grid(axes2, 'on');
        legend(axes2, 'Baa', 'Bbb', 'Bcc', 'Bnet');

        xlabel(axes1, 'Flux Density (T)');
        ylabel(axes1, 'Flux Density (T)');
        title(axes1, 'Rotating Magnetic Field');

        xlabel(axes2, 'Time (sec)');
        ylabel(axes2, 'Flux Density (T)');
        title(axes2, 'Magnetic Fields in Time Domain');
        
        % Rotating magnetic field plot
        subplot(1, 2, 1);
        circle = 1.5 * (cos(w*t + angle_rad) + 1i*sin(w*t + angle_rad));
        plot(axes1, real(circle), imag(circle), 'k', 'LineWidth', 2);
        hold(axes1, 'on');
        Baa_ref = 1.5 * (cos(angle_rad) + 1i*sin(angle_rad));
        Bbb_ref = 1.5 * (cos(2*pi/3 + angle_rad) + 1i*sin(2*pi/3 + angle_rad));
        Bcc_ref = 1.5 * (cos(-2*pi/3 + angle_rad) + 1i*sin(-2*pi/3 + angle_rad));
        line(axes1, [0 real(Baa_ref)], [0 imag(Baa_ref)], 'Color', 'k', 'LineStyle', ':');
        line(axes1, [0 real(Bbb_ref)], [0 imag(Bbb_ref)], 'Color', 'k', 'LineStyle', ':');
        line(axes1, [0 real(Bcc_ref)], [0 imag(Bcc_ref)], 'Color', 'k', 'LineStyle', ':');
        text(axes1, 1.6 * cos(angle_rad), 1.6 * sin(angle_rad), '\bfB_{aa}');
        text(axes1, 1.6 * cos(2*pi/3 + angle_rad) - 0.2, 1.6 * sin(2*pi/3 + angle_rad) + 0.1, '\bfB_{bb}');
        text(axes1, 1.6 * cos(-2*pi/3 + angle_rad) - 0.2, 1.6 * sin(-2*pi/3 + angle_rad), '\bfB_{cc}');
        h1 = line(axes1, [0 real(Baa(1))], [0 imag(Baa(1))], 'Color', 'k', 'LineWidth', 2);
        h2 = line(axes1, [0 real(Bbb(1))], [0 imag(Bbb(1))], 'Color', 'b', 'LineWidth', 2);
        h3 = line(axes1, [0 real(Bcc(1))], [0 imag(Bcc(1))], 'Color', 'm', 'LineWidth', 2);
        h4 = line(axes1, [0 real(Bnet(1))], [0 imag(Bnet(1))], 'Color', 'r', 'LineWidth', 2);
        title(axes1, '\bfRotating Magnetic Field');
        xlabel(axes1, '\bfFlux Density (T)');
        ylabel(axes1, '\bfFlux Density (T)');
        axis(axes1, 'square');
        axis(axes1, [-2 2 -2 2]);

        % Magnetic fields in time domain plot
        subplot(1, 2, 2);
        title(axes2, '\bfMagnetic Fields in Time Domain');
        ylabel(axes2, '\bfFlux Density (T)');
        xlabel(axes2, '\bfTime (sec)');
        axis(axes2, [0 n*T -2 2]);
        grid(axes2, 'on');
        hold(axes2, 'on');
        plot(axes2, t, real(Baa), 'c');
        plot(axes2, t, real(Bbb), 'b');
        plot(axes2, t, real(Bcc), 'm');
        plot(axes2, t, real(Bnet), 'r');
        legend(axes2, 'Baa', 'Bbb', 'Bcc', 'Bnet');
        hold(axes2, 'off');
    end

    updatePlots(); % Update plots at the beginning
end

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

good afternoon could you help me by modifying a code with a nicer interface and showing me lines of fields but please modify it yourself. 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education