Mercurial > hg > ltpda
comparison m-toolbox/classes/@unit/power.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % POWER implements power operator for unit objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: POWER implements power operator for unit objects. | |
5 % | |
6 % CALL: a = a1.^scalar | |
7 % | |
8 % VERSION: $Id: power.m,v 1.7 2011/02/18 16:48:55 ingo Exp $ | |
9 % | |
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | |
12 function v = power(vi, exp) | |
13 v = copy(vi, 1); | |
14 if ~isnumeric(exp) | |
15 error('### Can only raise units to a numeric power.'); | |
16 end | |
17 v.exps = v.exps*exp; | |
18 | |
19 end |