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
Reply vidya 2/25/2011 5:45:35 AM

"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
Reply Yumnam 2/25/2011 8:18:04 AM


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
Reply Think 2/25/2011 8:41:00 AM

2 Replies
514 Views

(page loaded in 0.169 seconds)

Similiar Articles:













7/22/2012 4:38:08 PM


Reply: