writing null space basis in MATLAB without using null(A) - matlab

My teacher wants us to find the basis of the null space of a function in MATLAB. This is the exact question.
Use the MATLAB function rref and the function lead above to write a MATLAB
function N=nullbase(A) which computes a matrix N whose columns form a basis
for the nullspace of A. Your file nullbase.m should not use the MATLAB functions
rank or null.
Please someone help me, thank you.

What you're looking for is the SVD (singular value decomposition). Because this sounds like a homework problem, I won't give away the whole answer, but this hint should help. MATLAB has an SVD function: http://www.mathworks.com/help/techdoc/ref/svd.html

Related

Null Vector in LabVIEW

I need to find the "null vector" of the matrix in LabVIEW. But I couldn't find the related block.
For example in MatLab, for the Matrix A we can simply find the null vector with the command: null(A); But in LabVIEW I can't do this till now.
Could someone help me?
One easy way to do this is to use the MathScript node, which allows for many Matlab commands to be used in LabVIEW. Here's an example:
If you don't want to use the MathScript node, then you can get the result from the "Matrix V" output of "SVD decomposition" as shown in the second part of the code.

Parameter estimation (MLE) of a truncated Pareto distribution

i'm new here and i am super desperate so i really hope anyone of you can help me....
i have a sample of random data x_1....x_n and i want to fit a truncated pareto distribution to the data.... to fit a generalized pareto distribution is super easy and i have already done that. I calculated the shape and scale parameters with a matlab routine.
But for the truncated pareto distribution i can't seem to find a routine to calculate the parameters i need...
Does anybody have an idea how to do it?
Thanks in advance!
You can use Markov-Chain-Monte-Carlo simulations to do Bayesian Inference to get the most likely parameters of your generalized pareto distribution for the given data. Or you stay with the maximum likelihood method. Your problem can be solved in many ways. But if you want to apply MLE you actually just need to search for a maximum. You could do it with fminsearch()
http://de.mathworks.com/help/optim/ug/fminsearch.html
For this you just need to define another function in a separate m-file which computes your Likelihood or Log-Likehood for a given set of parameters of your truncated pareto distribution. fminsearch now returns you the optimal parameters according to this likelihood. Is this the kind of routine you are looking for?

Principal Component Analysis w/ Alternating Least Squares for Missing Data

In MATLAB R2014b there is a new function, pca(), that performs PCA that can handle missing data. In the documentation it says that it performs pca with the "alternating least squares" algorithm in order to estimate the missing values.
I would like to know if there are any practical references in how to apply PCA with this algorithm without the use of the function, or if there is a good reference on als. The reason is, there is no such function in Octave that can handle missing data and so I would like to code it myself.
Thanks for all your help. I went through the references and was able to find their matlab code on the als algorithm from two of the references. For anybody wondering, the source code can be found in these two links:
1) http://research.ics.aalto.fi/bayes/software/index.shtml
2) https://www.cs.nyu.edu/~roweis/code.html

How to Supply the Jacobian to Fsolve?

pow=fsolve(#eqns,pop);
This is the code I am using to solve a 2x2 non-linear system of equations, defined in the function eqns.m.
pop is a 2x1 initialisation vector pretty close to the solution. When I run it, the output says
No solution found.fsolve stopped because the relative size of the current step is less than the default value of the step size tolerance squared, but the vector of function values is not near zero as measured by the default value of the function tolerance.<stopping criteria details>
Any way out? I tried moving the initial point further away from the solution intentionally, still it is not working. How do I set the tolerance or some other parameter? Some posts gave me the impression that supplying the jacobian to matlab can be helpful, but how do I do that? Please note that I need the solution in the form of a code which I can put in a function file to be called repeatedly. I believe the interactive optimtool toolbox would not help here. Any help please?
Also from the documentation, the fsolve can employ three different algorithms. Is any of them more helpful than the others for certain problem structures? Where can I get a comparative study of them, suitable for some non-expert in optimisation?

How can I numerically solve equations containing Bessel functions in MATLAB?

I have confronted an equation containing Bessel functions of the first type on one side and modified Bessel functions of the second type on the other. I want to know its exact solutions (values of u). The equation is as follows:
u*besselj(s-1,u)/besselj(s,u)=-w*besselK(s-1,w)/besselk(s,w)
where s is an arbitrary integer number, for example 2.
w can be written as a function of u:
w=sqrt(1-u^2);
and so this equation has only one variable: u
I'm new to MATLAB. I have no idea about how I should approach this. Could anyone please help me?
A quick thing to try may be the FZERO function, a generic nonlinear zero finder. To learn how to use it, you can implement the examples given in the documentation. Then, rewrite your function so it can be input to fzero and see what you get..
(Note: I haven't tried this, but I just noticed there were no replies yet so maybe it's better than nothing.)