Respondida
colorbar: cdata and colors
The CAXIS command can used to set the scaling limits on the color, in the same way that you set XLIM or YLIM. For example: ...

casi 14 años hace | 1

| aceptada

Respondida
Block Diagonal matrix multiplication with a sparse matrix
Although (A'*B) can be done quickly, the answer is no longer sparse. It is just some complex matrix. So then you are basically m...

casi 14 años hace | 0

Respondida
about nested for loop
D=sum(sum(B.*(C*A*C')))

casi 14 años hace | 2

Respondida
Sorry but cannot fsolve this and don't know why
Ok, you have a very subtle, but pathological problem with your code. Compare this: y = [ (1)... +2] To this: ...

casi 14 años hace | 0

Respondida
Plot contours at a level I wish
Here's one idea. First change this line: contour(N,P,H,[-2,-1.99,-1.98,-1.97,-1.96]); to this (in order to get the ha...

casi 14 años hace | 0

Respondida
Matrix multiplication (best computational approach)
I think you might be better off grouping your multiplications so that you maximize matrix-vector products instead of matrix-matr...

casi 14 años hace | 2

| aceptada

Respondida
Multiplying certain dimensions of two 3D matrices
A = rand(30,30,50); B = rand(30,30,80); C = reshape(A,900,[])'*reshape(B,900,[]);

casi 14 años hace | 2

Respondida
Triangular surface
There is also the SURF2PATCH function, which can turn quadrilaterals into triangles. For example: figure; [x,y,z] = sphe...

casi 14 años hace | 0

Respondida
Solving Systems of Linear Equations
Solving for each row of X is an independent optimization problem that can be solved easily with LSQNONNEG (available from the Op...

casi 14 años hace | 0

| aceptada

Respondida
removing unwanted pixels
Maybe IMFILL might work? A = [1 1 1 1; 1 0 1 0; 1 1 1 0] imfill(A) imfill(A) - A

casi 14 años hace | 0

Respondida
Do what Excel does in curve fitting in Matlab
Wayne gives a good way to do it, but in the latest version of the Statistics Toolbox, there is some great functionality that mak...

casi 14 años hace | 1

Respondida
Matrix operations without for structure
M = 60e3; N = 2; A = rand(M,N); s = rand(N,N); Am = bsxfun(@minus,A,mean(A)); %subtract the column means ...

casi 14 años hace | 0

Respondida
How to solve b≤Cx≤z with linear programming?
You can solve this with LINPROG, but I think you need help in understanding how to formulate your constraints properly. Const...

casi 14 años hace | 1

Respondida
Sparse matrix memory problem
Sparse matrices keep track of data by each column. This means that if you have a lot of columns (here you have one billion of th...

casi 14 años hace | 0

| aceptada

Respondida
Set boundary for least-square calculation
LSQLIN can do this: W = rand(10,5); y = rand(10,1); someOtherGivenNumber = 1.3; opts = optimset(optimset('ls...

casi 14 años hace | 0

| aceptada

Respondida
Vectorise an n dimensional raise to the power loop
You can call BSXFUN more than once: x = rand(1,1000); m = 30; n = 40; tic P1 = zeros(m,n,numel(x)); for ...

casi 14 años hace | 0

| aceptada

Respondida
Virtual Mouse Project
MATLAB can move the mouse around: x = 500; y = 600; set(0,'PointerLocation',[x y]); But, I think you do need t...

casi 14 años hace | 0

Respondida
vectorizing nested loops
Vectorization would probably involve calling NDGRID and then doing a bunch of logical indexing. It would take a lot more memory....

casi 14 años hace | 1

Respondida
Calculation/ Visualisation of circular planes in a 3D space
Here are two possible ideas. Given a circle center and a normal vector: R = 0.25; %Radius xyz = randn(1,3); %Circle cent...

casi 14 años hace | 2

| aceptada

Respondida
Help with numerical differentiation
If you have the Curve Fitting Toolbox, there are some functions in there that may be of use, like FIT and DIFFERENTIATE: x ...

casi 14 años hace | 1

Respondida
need help optimizing this code...
You can simplify the loop like this: for i=1:n v = w(i)*s(i)*sum( w(i+1:n) .* s(i+1:n) ); dTot = dTot + v; ...

casi 14 años hace | 1

Respondida
Solving Higher Order Matrix Polynomials
If k and q are not too large, one idea is to try to solve it as an optimization problem. "Which elements of X will yield the ...

casi 14 años hace | 0

Respondida
Graphing the Fourier Transform of a Square pulse: Problems with filled in sinc function, frequency axis, and amplitude.
Two things. 1. As you noticed, you are defining your f incorrectly. The resolution of f is equal to 1/T, where T is equal to ...

casi 14 años hace | 0

| aceptada

Resuelto


Omit columns averages from a matrix
Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...

alrededor de 14 años hace

Resuelto


Factorize THIS, buddy
List the prime factors for the input number, in decreasing order. List each factor only once, even if the factorization includes...

alrededor de 14 años hace

Resuelto


Too mean-spirited
Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

alrededor de 14 años hace

Respondida
Speed up recursive loop
Do you know about the command "FILTER" from the Signal Processing Toolbox? This operation can be done very quickly. nobs ...

alrededor de 14 años hace | 3

Respondida
calculation of mean , standard deviation and average for each pixel in an image M*N?
If you have the Image Processing Toolbox, the functions IMFILTER (can be used to do mean filtering on a neighborhood), S...

alrededor de 14 años hace | 1

Respondida
Changing the number of input arguments while calling a function in a loop
The cell array as mentioned above is a reasonable approach. Another possibility would be to modify your function so that the fun...

alrededor de 14 años hace | 0

Respondida
optimization
This type of problem can be easily set up in FMINCON, by employing the nonlinear constraint input parameter. As a concrete ex...

alrededor de 14 años hace | 0

Cargar más