How To Calculate Circle Area And Circumference Using GUI Matlab

in #utopian-io7 years ago (edited)

What Will I Learn?

  • You will learn about matlab programming
  • You will learn about build a GUI using matlab
  • You will learn about Circle Area
  • You will learn about Circle Circumference

Requirements

  • You must have a passion
  • You must have matlab basic
  • You must have interest

Difficulty

  • Intermediate

Tutorial Contents

In this tutorial, I decide to make a matlab tutorial. Because I think, matlab tutorial is still little. Matlab programming will give us a lot of conveniences, especially on GUI .

The functions of GUI are to provide ease in accessing something. And the user will be helpful with that view.

For now I will show how to make a matematics GUI, like calculate Circle Area and Circle Circumference.

We just need to input the radius value for it. And don't foget the formula of that things.

Circle Area = phi * radius * radius
Circle Circumference = 2 * phi * radius

Equipment

For equipment we just need a Matlab Application, you can use the anything version. For now I use Matlab r2014b.

Steps

  1. First run your matlab application, and open New>>Graphical User Interface. Until appear the picture like the following.
    gambar.png

  2. Lets start to design the GUI based on components like as.

    gambar.png

  3. Arrange the components at the above untill similar with this picture.

    gambar.png

  4. After that, open the editor above GUI that have we designed.

    gambar.png

  5. Then let's start to make the syntax. The existing syntax should not be deleted, we just must to add some syntaxs to below the functions. For details you can see these pictures:
    At function edit1_Callback:

    gambar.png

    The syntax list is:

function edit1_Callback(hObject, eventdata, handles)
radius=str2num(get(handles.edit1, 'String'));
handles.radius=radius;
guidata(hObject, handles)

At function btn_calculate_Callback:

gambar.png

The syntax list is:

function btn_calculate_Callback(hObject, eventdata, handles)
radius=handles.radius;
area=pi * radius * radius;
circum=2 * pi * radius;
set(handles.edit2, 'string', area);
set(handles.edit3, 'string', circum);

At function btn_exit_Callback:

gambar.png

The syntax list is:

function btn_exit_Callback(hObject, eventdata, handles)
delete(handles.figure1)

  1. Last, run the program and your GUI will be saved automatically.
    gambar.png

input "10" in radius column, and click calculate

gambar.png

And finally our GUI has finished.
If you need the full syntax, you can download it on Google Drive.

Thank you for your visiting.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it is not as informative as other contributions. See the Utopian Rules. Contributions need to be informative and descriptive in order to help readers and developers understand them.

You can contact us on Discord.
[utopian-moderator]

Hey @forkonti, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Can I post it again if I make more detail?
With a same post