Saturday, 31 May 2014

how to get started on matlab basics


Online Help


You can access the online help in one of several ways. Typing help at the command prompt will reveal a long list of topics

help general :see a long list of “general purpose” MATLAB commands
help solve: to learn about the command solve
helpwin or helpdesk at the command prompt to access the online help
syms to declare the variables
syms x y
(x - y)*(x - y)^2
expand(ans)
factor(ans)

Symbolic Expressions
simplify, which you can sometimes use to express a formula as simply as possible
simplify((x^3 - y^3)/(x - y))

arithmetic with symbolic expressions.

cos(pi/2)
cos(sym(’pi/2’)) - cosine of the symbolic representation of π/2

use of sym
create a string consisting of the characters pi/2 and prevent MATLAB from evaluating pi/2 as a floating point number. The command sym converts the string to a symbolic expression


to calculate the values of sin(0.1)/0.1, sin(0.01)/0.01, and sin(0.001)/0.001
x = [0.1, 0.01, 0.001];
y = sin(x)./x

 

No comments:

Post a Comment