Matlab arctanh function - matlab

I keep receiving an error while using the arctanh function on Matlab
Undefined function arctanh for input arguments of type 'double'.
I am doing this calculation
A = mu*arctanh(l2./(R2+R3))
Where l2 and R2 are vectors.

arctanh is only in MuPAD Notebook Interface:
http://www.mathworks.com/help/symbolic/mupad_ref/arctanh.html
Normally within MATLAB you should use atanh:
http://www.mathworks.com/help/matlab/ref/atanh.html

Related

using ilaplace in conjunction with rltool

Using Matlab, I have the following code:
s = tf('s')
K=0.5;
H= 1/(s*(s+2));
Hcl=feedback(K*H,1)
ilaplace(Hcl)
rltool(H)
I want to get the inverse laplace transform of the unity closed-loop system.
rltool(H) generates automatically the unity closed-loop system. That's why I pass the open-loop system as an argument.
When I run this code, Matlab gives an error about ilaplace:
"Check for incorrect argument data type or missing argument in call to function 'ilaplace'."
Can someone help me how to use ilaplace and rltool concurrently
I have found a solution for this problem.
syms s;
K=1/2;
H= 1/(s*(s+2))
Hcl=simplify(K*H/(1+K*H))
P=poles(Hcl)
ilaplace(Hcl)
H = syms2tf(Hcl)
rltool(H)
ilaplace works with symbolic expressions and not with a transfer function. By converting the symbolic expression to a transfer function midway of the code, I can use both functions in the same code.
Notice I've added the function simplify and changed the beginning from s=tf('s') to syms s
The function syms2tf() can be found here

Undefined function 'normalize' for input arguments of type 'double'

I want to use the MATLAB function "normalize" which normalizes the data to zero mean and unit variance. During the compilation, I still get the error:
Undefined function 'normalize' for input arguments of type 'double'.
Although this function support double inputs.
When I typed:
which normalize -all
I got:
C:\Program Files\MATLAB\R2017a\toolbox\signal\signal\#dfilt\normalize.m % dfilt method
Could any one help me please?
You're likely using a version of MATLAB older than R2018a, which is when the function normalize was first introduced. The which command is showing you a normalize method for dfilt class objects (from the Signal Processing Toolbox) that existed prior, which only accepts arguments of type dfilt.

Why is fgoalattain built-in function not working in MATLAB?

I'm trying to invoke an fgoalattain function (computing a function minimum with a goal-attainment algorithm) in MATLAB. According to documentation, it should look like this:
[X,FVAL,ATTAINFACTOR] = FGOALATTAIN(#objf_1,x0,goal,weight)
where #objf_1 is a function handle for a function defined in objf_1 m-file and the rest are some arguments I set on my own. They are not important in any case, because evidently MATLAB has a problem with that function, as it throws:
>> rospar_4
Undefined function 'fgoalattain' for input arguments of type 'function_handle'.
Error in rospar_4 (line 29)
[X,FVAL,ATTAINFACTOR] = fgoalattain(#objf_1,x0,goal,weight)
However, I already know that the function works fine on another MATLAB version - R2011b (the one I'm using is R2012b), but with first argument as char instead:
[X,FVAL,ATTAINFACTOR] = fgoalattain('objf_1',x0,goal,weight)
If I try to invoke it like this in mine though, the error is almost the same:
>> rospar_4
Undefined function 'fgoalattain' for input arguments of type 'char'.
Error in rospar_4 (line 29)
[X,FVAL,ATTAINFACTOR] = fgoalattain('objf_1',x0,goal,weight)
Any idea how am I getting this?
It is not a built-in function. You need to install the Optimization toolbox.

How to use dct2() in matlab?

I am trying to pass a matrix to dct2 function but it is showing error. I am using matlab version R2012a. I have a matrix B which just used as argument like below
B = dct2(A);
disp(B);
Error is showing like this
Undefined function 'dct2' for input arguments of type 'uint8'.
Error in image_dct (line 24)
B = dct2(A);
You have to have the image processing toolkit in order to use that. Assuming you have that, then it should be just as simple as you listed.

Quantile function causing error in MATLAB

I am using quantile function in the simplest form:
x = [1.2,3,4,5];
y = quantile(x,0.5);
But I get the error:
Undefined function 'quantile' for input arguments of type 'double'.
I was not having this error in MATLAB R2009a but get this error in R2012a.
What could be the reason?
Please run:
license('test', 'Statistics_Toolbox')
In case this returns a 0 then you do not have an active license of the statistics toolbox.
However if you want to use it as in your example the following code would do:
y = median(x);
quantile is part of the statistics toolbox. If you do not have access to that in your new installation, you will not be able to use the function.
To check which toolboxes you have installed, type ver at the command prompt.