Réponse apportée
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...

presque 15 ans il y a | 0

| A accepté

Réponse apportée
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 ...

presque 15 ans il y a | 2

| A accepté

Réponse apportée
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...

presque 15 ans il y a | 2

Réponse apportée
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...

presque 15 ans il y a | 2

Réponse apportée
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...

presque 15 ans il y a | 2

Réponse apportée
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...

presque 15 ans il y a | 0

Réponse apportée
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 ...

presque 15 ans il y a | 5

| A accepté

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

presque 15 ans il y a | 0

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

presque 15 ans il y a | 1

| A accepté

Réponse apportée
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....

presque 15 ans il y a | 1

Réponse apportée
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...

presque 15 ans il y a | 0

Réponse apportée
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 ...

presque 15 ans il y a | 1

Réponse apportée
similar matrix multiplication speed up
You can combine all of those multiplications into one expression using the properties of the matrix exponential. Compare thes...

presque 15 ans il y a | 0

Réponse apportée
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); ...

presque 15 ans il y a | 2

Réponse apportée
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...

presque 15 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 15 ans il y a | 0

Réponse apportée
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...

presque 15 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 15 ans il y a | 0

Réponse apportée
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...

presque 15 ans il y a | 0

Réponse apportée
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 ...

presque 15 ans il y a | 2

| A accepté

Réponse apportée
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,...

presque 15 ans il y a | 0

Réponse apportée
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...

presque 15 ans il y a | 2

Réponse apportée
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. [...

presque 15 ans il y a | 1

Réponse apportée
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...

presque 15 ans il y a | 1

| A accepté

Réponse apportée
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(...

presque 15 ans il y a | 1

| A accepté

Réponse apportée
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 (...

presque 15 ans il y a | 1

Réponse apportée
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(-...

presque 15 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 15 ans il y a | 2

Réponse apportée
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...

presque 15 ans il y a | 1

| A accepté

Réponse apportée
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); ...

presque 15 ans il y a | 3

Charger plus