image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

image Need some help with basics of MATLAB Share It Thread Tools Search this Thread image
Old May18-09, 03:06 PM                  #1
atlbraves49

atlbraves49 is Offline:
Posts: 71
Need some help with basics of MATLAB

I need some help with some basic MATLAB questions.

1) When writing a MATLAB code, do I create a blank new M-file, and write it there?

2) I need the program to calculate values for an equation, as I vary two variable within the equation. I'm unsure how to do this (for example, how do I define the variables, etc)

For example, say the equation is y = x^(-0.5) +z^(ln(x));

I want the program to give me values for y when i input different values for x and z. How is this accomplished?

If anyone can point me to good MATLAB tutorials that go into this kind of detail, I'd appreciate it. I've looked, including MATLABs help, and havent found anything regarding equations and variables, etc.

Lastly, how do you comment in MATLAB?
  Reply With Quote
Old May18-09, 03:47 PM                  #2
FredGarvin
 
FredGarvin's Avatar

Engineer Guru 2008

FredGarvin is Offline:
Posts: 4,729
Recognitions:
PF Contributor PF Contributor
Science Advisor Science Advisor
Re: Need some help with basics of MATLAB

There are hundreds of web pages out there that give the basics for how to do these things in Matlab. A quick Google search will get you going.
  Reply With Quote
Old May18-09, 04:20 PM                  #3
f95toli
 
f95toli's Avatar

f95toli is Offline:
Posts: 1,103
Recognitions:
PF Contributor PF Contributor
Science Advisor Science Advisor
Re: Need some help with basics of MATLAB

And the Help-files that come with Matlab are actually very good...
  Reply With Quote
Old May18-09, 05:37 PM                  #4
atlbraves49

atlbraves49 is Offline:
Posts: 71
Re: Need some help with basics of MATLAB

Originally Posted by atlbraves49
I've looked, including MATLABs help, and havent found anything regarding equations and variables, etc.


Can anyone provide some actual help regarding these questions?
  Reply With Quote
Old May18-09, 05:55 PM                  #5
MATLABdude

MATLABdude is Offline:
Posts: 875
Re: Need some help with basics of MATLAB

Originally Posted by atlbraves49 View Post
Can anyone provide some actual help regarding these questions?
Regarding this specific question, you're probably looking for an inline function:
http://en.wikibooks.org/wiki/MATLAB_...able_Functions

That's the serial way of doing things. However, you can often perform operations on entire vectors. If you wanted to calculate, say, sin(x) between 0 and 2pi, in increments of 1/200*pi (and then plot the result), you'd do the following:

>> x=0:1/200*pi:2*pi %The colon format goes start:increment:end
>> y=sin(x) %This will generate a vector of y values for a bunch of x's
>> plot(x,y)

Additionally, perhaps start here:
http://en.wikibooks.org/wiki/MATLAB_Programming

Or here:
http://www.mathworks.com/access/help...b/bqr_2pl.html

But if you need a quick reference for a command within MATLAB, just type help COMMAND, for instance, getting help about the identity matrix creation function:
>> help eye
  Reply With Quote
image image
Reply
Thread Tools


Similar Threads for: Need some help with basics of MATLAB
Thread Thread Starter Forum Replies Last Post
basics tayyaba aftab General Discussion 3 Apr19-08 03:31 AM
SQL basics pink_ele Programming & Comp Sci 4 Feb11-08 03:51 AM
Matlab: How to apply filters to and ECG signal using matlab? g2g Math & Science Software 1 Mar29-07 06:21 PM
basics please dvs77 Chemistry 3 May18-05 05:05 PM
basics...? magus niche Scepticism & Debunking 11 Nov26-04 07:13 PM

Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. © 2009 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image