Math  /  Algebra

Question1- Edition du premier fichier de fonction Taper la commande Matlab suivante : >>edit APDisque.m Saisir les commandes suivantes dans l'éditeur qui vient de s'ouvrir: function [a,p] = APDisque(r) \%---fonction calculant l'aire et le périmètre d'un disque de rayon r---\%  a = pi. 2 p =2. pi.  end \begin{array}{l} \text { a = pi. }{ }^{*} \wedge 2 \\ \text { p }=2 . \star \text { pi. } \\ \text { end } \end{array}
Sauvegarder et fermer l'éditeur.

Studdy Solution

STEP 1

1. You are using MATLAB to create a function.
2. The function is intended to calculate the area and perimeter of a disk given its radius.
3. The function will be saved in a file named "APDisque.m".

STEP 2

1. Open the MATLAB editor to create a new function file.
2. Write the function code in the editor.
3. Save and close the editor.

STEP 3

Open MATLAB and type the following command in the command window to open the editor: >> edit APDisque.m \texttt{>> edit APDisque.m}

STEP 4

In the editor that opens, type the following code to define the function:
```matlab function [a, p] = APDisque(r) %---function calculating the area and perimeter % of a disk with radius r---% a = pi * r^2; p = 2 * pi * r; end ```

STEP 5

Save the function by clicking on "File" and then "Save", or by using the shortcut Ctrl+S (Cmd+S on Mac).
Close the editor after saving.
The MATLAB function "APDisque.m" is now created and saved, ready to be used for calculations.

Was this helpful?

Studdy solves anything!

banner

Start learning now

Download Studdy AI Tutor now. Learn with ease and get all help you need to be successful at school.

ParentsInfluencer programContactPolicyTerms
TwitterInstagramFacebookTikTokDiscord