ML10 - Matlab 10 Function Fun Tian Gu ID: 853324472...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Matlab 10 Function Fun Tian Gu ID: 853324472 Introduction In this lab, we solved the question of 4 queens at first. We also have seen how the functions were made, and we used MATLAB to write new function multiply ourselves. The most important part is writing dice function. And after that we tried to write a dice game called Pig. We finished some parts of this program. In the hands-on part, we have already finished the RC-circuits in the last lab, this time we tried to measure the amplitude at different frequencies and made a conclusion of them. 4 Queens-ByHand A Simple Function We first try the function doubleIt by running this m-file. >> doubleIt(8) ans = 16 It worked well. So now we can try to make a function just like that. We want to multiply two numbers, we can input them like (x, y), so we get: function [mutiply] = multIt(x,y); [multiply] = x.*y end Output: >> multIt(2,3) multiply = 6 Dice - Write your own function According to the instruction we should use the function rand and ceil, so we can use...
View Full Document

This document was uploaded on 11/17/2011.

Page1 / 4

ML10 - Matlab 10 Function Fun Tian Gu ID: 853324472...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online