Displaying 2 results from an estimated 2 matches for "gamama".
2005 Feb 15
1
matlab norm(h) command in R: sqrt(sum(h^2)) - use in an expression
Hi
in matlab I defined a function (double gamma, parameters at the end of
this mail) as
h(i)=((t/d1)^a1)*exp(-(t-d1)/b1)-c*((t/d2)^a2)*exp(-(t-d2)/b2);
h=h/norm(h);
I do know that norm() in matlab is equal to:
sqrt(sum(x^2))
in R
so in R I do it like:
#function (double gamama)
h <- expression((t/d1)^a1*exp(-(t-d1)/b1)-c*(t/d2)^a2*exp(-(t-d2)/b2))
# plot it
t <- seq(0, 20000, by = 100)
t <- t/1000
plot(eval(h), type = 'l')
# however this yields an error
h <- h/sqrt(sum(h^2))
Error in h^2 : non-numeric argument to binary operator
what shall I do to...
2005 Feb 15
0
matlab norm(h) command in R: sqrt(sum(h^2)) - use in an e xpression
...mma, parameters at
> the end of
> this mail) as
> h(i)=((t/d1)^a1)*exp(-(t-d1)/b1)-c*((t/d2)^a2)*exp(-(t-d2)/b2);
> h=h/norm(h);
>
> I do know that norm() in matlab is equal to:
>
> sqrt(sum(x^2))
> in R
> so in R I do it like:
>
> #function (double gamama)
> h <- expression((t/d1)^a1*exp(-(t-d1)/b1)-c*(t/d2)^a2*exp(-(t-d2)/b2))
>
> # plot it
> t <- seq(0, 20000, by = 100)
> t <- t/1000
> plot(eval(h), type = 'l')
>
> # however this yields an error
> h <- h/sqrt(sum(h^2))
^ ^
Those are...