Buscar

MATLAB EXERCÍCIOS

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis

Prévia do material em texto

jorge gomes
MATLAB Onramp 21% complete
2.1 Entering Commands
1 - Info: You can execute commands by entering them in the command window after the MATLAB prompt (>>) and pressing the Enter key.
Try multiplying the numbers 3 and 5 together with the command 3*5.
2 - Info: Unless otherwise specified, MATLAB stores calculations in a variable named ans.
>> 7+3
ans = 
 10
Try assigning the 3*5 calculation to a variable named m as shown: 
m = 3*5
3 - Info: The equals sign (=) in MATLAB is the assignment operator, meaning that the expression on the right of the equals sign is assigned to the variable on the left. So, when you enter x = 3+4, MATLAB first evaluates 3+4 and then assigns the result (7) to the variable x.
Try entering the command m = m + 1 to see what happens.
4 - Info: Notice that the Workspace window (on the right) shows all the variables currently in the workspace.
Now try creating a variable named y that has the value m/2.
5 - Info: Adding a semicolon to the end of a command will suppress the output, though the command will still be executed, as you can see in the Workspace. When you enter a command without a semicolon at the end, MATLAB displays the result in the command window.
>> x = 5+1
x = 
 6
>> x = 5+1;
 
Try entering k = 8-2;
with a semicolon at the end.
6 - Info: You can recall previous commands by pressing the Up arrow key on your keyboard. Note that the Command Window must be the active window for this to work.
Try pressing the Up arrow to return to the command m = 3*5 and edit the command to be m = 3*k	
7 - Info: When you enter just a variable name at the command prompt, MATLAB returns the current value of that variable.
Was y recalculated when m was modified? Try entering just the variable name y at the command prompt (and pressing Enter).

Perguntas relacionadas

Perguntas Recentes