Answered
Importing a text file with two headers and data so that the headers are the variable names
There are a lot of ways to deal with reading in data. This is one imaginative way of doing it, but I think it should work. (Her...

14 years ago | 0

| accepted

Answered
Finding the point of inflection on a curve
You need to find where the 2nd derivative is zero. There are many different ways to approach this. This is one possible way: ...

14 years ago | 0

| accepted

Answered
invers from covariance of a matrix*matrix'
cov(a) is ALWAYS singular for ANY square matrix a, because you subtract off the column means. This guarantees that you reduces t...

14 years ago | 0

| accepted

Answered
Fastest way of computing standard errors / inverting X'X
You can use symbolic math to find the inverse of a symmetric 3x3 matrix: syms a b c d e f real M = diag(inv([a b c; b d ...

14 years ago | 0

| accepted

Answered
Misbehaving script
In your function handle, the "Q" that it is referencing is the original Q at the time you created the function handle. It is not...

14 years ago | 1

| accepted

Answered
Finding the indices of the elements of one array in another
If A is sorted, then I think this is probably the easiest (and also fastest?) way to do it. [~,idx] = histc(B,A) If A is...

14 years ago | 0

Answered
a matrix equation problem
If B is invertible: x = sqrt(eig(B\A)) Reason: det(A-B*x^2) = 0 implies that det(B\A-I*x^2) = 0 If B is not ...

14 years ago | 0

Answered
help with dynamic variable names set with 'for' incrementer
You are right in that using EVAL to dynamically generate variable names is generally a messy approach that's not very readable, ...

14 years ago | 0

| accepted

Answered
fractional delay using FFT,IFFT
Ok. You've pretty much written exactly what you need to do. This is the right idea: signal(x)->X=FFT(x)->Y=X*exp(-j*2*pi*f*dt...

14 years ago | 6

Answered
cell operation
Maybe something like this? M{1,1} = {1 3 5 0} M{2,1} = {2 4 6 -1} M{3,1} = {7 8 9 2} cat(1,M{:})

14 years ago | 1

| accepted

Answered
histogram, indices of values used from the vector for each class?
If you have access to the functions in the Statistics Toolbox, I think GRPSTATS may help you c1 = [ 1 3 2 1 3 1 2 2 3 3 2 2...

14 years ago | 0

| accepted

Answered
Linprog and Max Function
Notice that f(d) = Df*d + max(0, g + Dg*d) + abs(h + Dh*d) is the same as f(d) = Df*d + max(0, g + Dg*d) + max(h + Dh*d, ...

14 years ago | 0

| accepted

Answered
How can i multiply the transfer function with a vector)
You need to invert the transfer function. But simply taking 1/G leaves you with more zeros than poles, and so you cannot exactly...

14 years ago | 2

Answered
Linprog and Max Function
Assuming by "just numbers" you mean "(constant) arrays", you can solve it by solving two linear programming problems. Step 1....

14 years ago | 0

Answered
How can i multiply the transfer function with a vector)
You can use the LSIM command. For example: s = tf('s'); G = (1.659e010*s^2 + 9.123e012*s + 4.147e014)/ (1.011e-005*s^7 + 0...

14 years ago | 2

| accepted

Answered
Newbie to Matlab: How to find duplicates within a cell of arrays, arrays have varying sizes
Here is a one rather exotic way of doing it: % Step 1: Convert to strings Aunique = cellfun(@(x)char(typecast(x,'uint8')...

14 years ago | 1

| accepted

Answered
Impulse Response using Dirac(t)
I think this is a very good question. Here is my explanation, but maybe someone can give a better one. In this equation: ...

14 years ago | 2

| accepted

Answered
How to rotate a function about the y-axis
Something like this maybe? [X,Y]=meshgrid(-20:0.1:20); R = sqrt(X.^2 + Y.^2); J=besselj(1,R); Z=(J./R); Z(...

14 years ago | 1

| accepted

Answered
Fast multiplication of rows of one matrix and columns of the second matrix
The fastest way to do something generally depends on the size and structure of your data. Don't assume loops are slower. For si...

14 years ago | 2

| accepted

Answered
Strange problem in plotting
Are you sure you did your hand calculation correctly? I think the second result is correct. The result you are seeing is due ...

14 years ago | 0

| accepted

Answered
Least squares problem with large matrix
Ok. I have an idea. So you basically have some linear function A(x) -> b that takes the vector space of [5x300] matrices and ...

14 years ago | 0

Answered
Line and a Line segment intersection
Define t = (c - y1 + m*x1)/(y2 - y1 + m*(x1 - x2)) * If 0 <= t <= 1, then they intersect at exactly one point. * If ...

14 years ago | 2

| accepted

Answered
Linear data fitting
The problem is that your data is scaled very differently than the random data. If you normalize the data to a better scale firs...

14 years ago | 0

| accepted

Answered
Linear data fitting
One possible way, if you have access to the functionality in the Optimization Toolbox, is to treat this as an optimization probl...

14 years ago | 0

Answered
Ordering graphics objects
The UISTACK command is used to order graphics objects. help UISTACK

14 years ago | 0

Answered
Solving for an unkown matrix
This is the Sylvester equation. You can solve it using the LYAP command. A = rand(3); B = rand(3); C = rand(3); P ...

14 years ago | 1

| accepted

Answered
BVP with no solution
The boundary conditions you wrote in your code are actually y(0) = 0; y(pi) = 1. But that's besides the point. As you said yo...

14 years ago | 1

Answered
matrix logical indexing
In the case of checking bounds by combining two logical statements, I think the following expression will generally be significa...

14 years ago | 0

Answered
how to plot functions of theta and phi..for example {cos(phi).^3 * sin(theta)+sin(phi)} in spherical coordinates.
First create a grid using spherical coordinates, and then convert the result into Cartesian coordinates. [theta,phi] = meshgr...

14 years ago | 0

Answered
Minimizing a function
This is a quadratic programming problem, and can be solved very easily using QUADPROG. The only thing is correctly expressing th...

14 years ago | 0

Load more