PDA

View Full Version : How to create m-file with matlab?


View Full Version : How to create m-file with matlab?


ltev2006
December 13th, 2006, 08:37 AM
ok, I have this problem... anyone knows how to create m-file with matlab?

ltev2006
December 13th, 2006, 08:54 AM
The problem is that I dont have Matlab now... I just need to know what is the result of this:

>> b1=(-1:0.1:0)
>> b2=(-1:0.1:0)
>> H=(-1:0.1:0)'
>> b=(b1+b2)
>> bx=b/2
>> A=bx*H

if someone has Matlab, pls paste this code and tell me what is the result. I really need to know...

cjules13
December 13th, 2006, 10:16 AM
It's just a text file with your commands with a .m extension. You could create it in notepad or wordpad if you wanted, but MATLAB comes with a default m-file editor and it's easier to keep track with everything in their gui, so use that.

cjules13
December 13th, 2006, 11:40 AM
Why do I have the feeling I just did your homework? :)

Use semicolons after each line if you don't want it to report on each line, but here is the result:



b1 =
Columns 1 through 9
-1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000 -0.2000
Columns 10 through 11
-0.1000 0

b2 =
Columns 1 through 9
-1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000 -0.2000
Columns 10 through 11
-0.1000 0

H =
-1.0000
-0.9000
-0.8000
-0.7000
-0.6000
-0.5000
-0.4000
-0.3000
-0.2000
-0.1000
0

b =
Columns 1 through 9
-2.0000 -1.8000 -1.6000 -1.4000 -1.2000 -1.0000 -0.8000 -0.6000 -0.4000
Columns 10 through 11
-0.2000 0

bx =
Columns 1 through 9
-1.0000 -0.9000 -0.8000 -0.7000 -0.6000 -0.5000 -0.4000 -0.3000 -0.2000
Columns 10 through 11
-0.1000 0

A =
3.8500
>>

Potato
December 13th, 2006, 07:02 PM
Threads merged.

cjules13
December 13th, 2006, 07:33 PM
Thanks Tater :)

adirael
March 5th, 2007, 08:23 PM
did you work on matlab 2006?