COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

arg function in matlab

• Follow

```we have to calculate least square estimate for geometrical transformation as follows

r=unit matrix
t=0
v = (i-(r*j)-t);
s=(norm(v).^2);

[r t]=arg( min(sum(s)));

how to use <arg> in matlab?.
```
 0

```"vidya " <vidya90rv@gmail.com> wrote in message <ik7flv\$jl\$1@fred.mathworks.com>...
> we have to calculate least square estimate for geometrical transformation as follows
>
> r=unit matrix
> t=0
> v = (i-(r*j)-t);
> s=(norm(v).^2);
>
> [r t]=arg( min(sum(s)));
>
> how to use <arg> in matlab?.

What your arg function intend to perform? What inputs it takes and what outputs it gives?
Yumnam Kirani Singh
Tronglaobi Awang Leikai
```
 0

```On 24/02/11 11:45 PM, vidya wrote:
> we have to calculate least square estimate for geometrical
> transformation as follows
>
> r=unit matrix
> t=0
> v = (i-(r*j)-t);
> s=(norm(v).^2);
>
> [r t]=arg( min(sum(s)));
>
> how to use <arg> in matlab?.

In non-vectorized form:

function a = argument(z)
re = real(z);
im = imag(z);
if im
if re
a = arctan(im/re);
else
a = sign(im) * pi/2;
end
else
if re < 0
a = pi;
else
a = 0;
end
end
end

There may well be a simpler way; I worked this up from the definition.
```
 0

2 Replies
514 Views

Similiar Articles:

7/22/2012 4:38:08 PM