220 likes | 374 Views
Introduction to Matlab. By. Dr. Adil S. Balghonaim. Mat lab. Matrix. Laboratory. The program is capable of doing matrix algebra on all type of matrix. Create new folder and rename it. Short cut for Matlab. You also can start matlab from desktop as follows. Start. All Programs. Matlab.
E N D
Introduction to Matlab By Dr. Adil S. Balghonaim
Matlab Matrix Laboratory The program is capable of doing matrix algebra on all type of matrix
Create new folder and rename it Short cut for Matlab
You also can start matlab from desktop as follows Start All Programs Matlab
Start programming >> a=3 a = 3 >>
Semicolon “ ; ” at the end of a statement will not print the value in the screen >> b=4 ; >> However the variable “ b “ with the value 4 is still there and can be used >> b b = 4 >>
>> c=a+b c = 7 >> sqrt(c) ans = 2.6458 >> If you did not specify a variable for the result it will store it at “ ans”
You also can make a program and execute the sequence of commands File M-File
File name File type is *.m
Directory were Matlab access You either move you’re the M-file you just Created (p1.m ) to that directory OR Change the current directory to were the file reside In that case change it to the EE 207 –Matlab folder In the desktop
Click here to Change the directory
Now you are at the same directory were the file And matlab can be excuted
>> p1 will execute the file p1.m Line by line Result c = 7
Vectors >> a=[1 2 3] a = 1 2 3
Complex Numbers >>a=3+(j*4) a = 3.0000 + 4.000 i >>angle(a) ans = 0.9273 >>abs(a) ans = 5 radian
>>angle(a) ans = 0.9273 radian >> angle(a)*180/pi ans = 53.1301 degree
>>b=12+(4*i) b = 12.0000+4.000i >> a+b ans = 15.0000 + 8.0000 i