Answered
bucketing values
If you have the Statistics Toolbox installed, there is the built-in RANDSAMPLE command to do this. A = [0.8756 0.1185 0.005...

14 years ago | 0

| accepted

Answered
number^matrix plz help me on this, I cant understand this, plz help me
If the exponent was a scalar, say a=2, then : a = 2; 3^2 = 9 = exp(2 * log(3)) If you define z = 2*log(3), then ...

14 years ago | 2

| accepted

Answered
Using return values of functions without storing them?
As has been noted above, what you are trying to do is not possible. But even when you nest functions inside of each other, MATLA...

14 years ago | 2

Answered
Get next plot color
This seems to work ok: figure hold all; plot(rand(5,3)); h = plot(nan,nan); nextcolor = get(h,'color') h...

14 years ago | 2

Answered
Making a single color transparent in a figure
You can set the 'alphadata' property of the image: image(X,'alphadata',X ~= 1) OR h = image(X); set(h,'alphadata...

14 years ago | 2

Answered
Code vectorization problem
You never want to build a sparse using a loop like this. The SPARSE command is designed to handle that entire loop straight f...

14 years ago | 0

Answered
How to get a list of all open files in Matlab editor?
As mentioned in the links below in Jan Simon's answer, there is the matlab.desktop.editor X = matlab.desktop.editor.getAll ...

14 years ago | 5

| accepted

Answered
strfind when I have more than one row
STRFIND works on cells too: a=['Congratulations' 'to Walter ' 'for his 4000 ' 'reputation ...

14 years ago | 0

Answered
Matching two texts
The simple brute force method: A='Lehman Brothers Merill Lynch'; B='First Boston Corp Lehman Brothers'; for n ...

14 years ago | 1

| accepted

Answered
Calculating the Log-Likelihood Value Produced at dfittool
The log likelihood is calculated like this: 1. Evaluate the PDF at each data-point. 2. Take the log of those values. 3....

14 years ago | 1

Answered
Moving Avg calculation
One nice thing about MATLAB is that you can edit a lot of the functions to see what's inside. edit movavg The code is we...

14 years ago | 0

Answered
Manipulating a video in Matlab (video processing)
There is a function IMRESIZE in the Image Processing Toolbox that is designed to do exactly this, and it will take into account ...

14 years ago | 1

Answered
similar matrix multiplication speed up
You can combine all of those multiplications into one expression using the properties of the matrix exponential. Compare thes...

14 years ago | 0

Answered
How do I round to the nearest arbitrary, enumerated value in MATLAB?
I believe HISTC is the fastest and most memory efficient way to solve this problem for large cases. v = 10*rand(1,1000000); ...

14 years ago | 2

Answered
Moving point along a curve (3D-Animation plots)
Phong lighting tends to slow things down a lot. If you can do without it, that will speed things up considerably. props.FaceL...

14 years ago | 1

| accepted

Answered
plot 3D
A = interpft(rand(1,10),1001); B = interpft(rand(1,10),1001); C = interpft(rand(1,10),1001); t = 0:0.001:1; fi...

14 years ago | 0

Answered
help to find similar variables and add them togeher
If you have the Statistics Toolbox, you can use GRPSTATS: t=[0.1 0.3 0.2 0.1 0.4 0.2 0.5 0.9 0.7 0.1 0.4 0.8 0.25 0.2 0.3 0...

14 years ago | 0

| accepted

Answered
Solving overdetemined (non-square) linear system using the GPU.
The pseudoinverse can be found by inv(A'*A)*A' Thus you can solve your problem like this: A = rand(4000,1000); b = ra...

14 years ago | 0

Answered
indexing nearest number problem
For this problem, I suspect HISTC may be a better (faster and more memory efficient) alternative to BSXFUN. A = rand(384,32...

14 years ago | 0

Answered
Curve interpolation problem
Maybe something like this? XX=[100.0000 167.3203 359.0253 410.6382 585.7535 716.6290 712.9424 476.9977 364.5553 185.7535 ...

14 years ago | 2

| accepted

Answered
Magnetic field in a square loop 3D graph
Whatever you are doing with FOR loops is not necessary. MATLAB can work with matrices much more simply: I = 100; [X,...

14 years ago | 0

Answered
Optimal arrangement of a small vector within a lager vector
Your problem can be expressed as an overdetermined system: Given A and b where A = [ 1 2 3 2 1 0 0 0 0 0 0; 0 1 2...

14 years ago | 2

Answered
How do I find the boundaries of a value in a matrix?
This will give all the 8's that are not entirely surrounded by other 8's. Assuming you have the Image Processing Toolbox. [...

14 years ago | 1

Answered
function setup in fmincon
FMINCON only passes in one variable (the variable to be optimized) to the objective function. If w is constant, and you are tryi...

14 years ago | 1

| accepted

Answered
insert into array with probability
% Make some arbitrary a, b, and confidence matrix a = randi(10,[1 10]); b = 100*(1:numel(a)); confidence = rand(size(...

14 years ago | 1

| accepted

Answered
Wrapped smoothing
Step 1. Rescale from (0,360) to (-pi,+pi) Step 2. Unwrap the data using UNWRAP Step 3. Smooth it Step 4. Rescale from (...

14 years ago | 1

Answered
Bode diagram of a rectangular pulse
A rectangular pulse is a step function minus a delayed step function: T = 1; s = tf('s'); bode(ss(1/s) - ss(1/s*exp(-...

14 years ago | 1

| accepted

Answered
plot Complementary Cumulative DIstribution
cdfplot calls cdfcalc. You can use this to get the actual values. X = randn(10000,1); [ycdf,xcdf] = cdfcalc(X); x...

14 years ago | 2

Answered
Using mean function
The reshape command can help to implement this: X = rand(18,1) Y = reshape(X,6,[]) mean(Y) or more simply, just: mean...

14 years ago | 1

| accepted

Answered
Length of the longest continuous string of the same number
A more explicit way of doing it: lenmax = 1; len = 1; for n = 2:numel(A) if A(n) == A(n-1); ...

14 years ago | 3

Load more