Réponse apportée
L1 Optimization in matlab
Make some d and F just to test it. d = [1;2;3;4;5]; F = [.1 .3 .5 .7 .9; .2 .4 .6 .8 1.0]; I can think of two ways. ...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
how can we represent the histogram of a vector without using the hist function ?
Is it that you just don't want the bar graph that comes up with HIST? If you call it with output arguments, you can get the valu...

environ 13 ans il y a | 0

Réponse apportée
Taking weighted means over matrices with missing data
M = [4 NaN 1 NaN; 5 3 8 NaN; 1 6 2 4; 8 4 7 2]; w = [0.4 0.3 0.2 0.1]; W = bsxfun(@times,~isnan(M),w); W = bsxfun(@...

environ 13 ans il y a | 0

Réponse apportée
Get rid of nested for loops?
A few observations: 1. A lot of the operations you are doing can me written more efficiently as matrix operations (dot prod...

environ 13 ans il y a | 4

| A accepté

Réponse apportée
How to find zero elements in a three dimensional matrix whose neighbors are all zero.
As you guessed, there are much simpler ways to do it using image processing techniques. % Just making some random data to w...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Intersection of Two Implicit Curves over a domain
This sort of problem can be solved easily using FSOLVE circ = @(x,y) x^2+y^2-4 elp = @(x,y) ((x-2))^2+((y+2)/4)^2-1 ...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
while loop in matlab password GUI
In your GUI case, the reason it displays 'a' after just one failed attempt is, this loop: username1= 'xxx'; password1= '...

environ 13 ans il y a | 0

Réponse apportée
How to calculate conditional sum of a part of vector/array based on a 2nd one
Just for comparison, here is a FOR loop solution. FOR loops can actually be very fast, even for large arrays, especially when yo...

environ 13 ans il y a | 1

| A accepté

Réponse apportée
Negative gain and phase margin, yet a stable and robust system... can somebody explain?
When I try that, I get something completely different. How are you defining your P and C? s = tf('s'); P= 1.429e-07*1/(s...

environ 13 ans il y a | 1

| A accepté

Réponse apportée
How to create a boxplot from a PDF?
How about something like this. Generate the CDF from your data as Tom suggested, invert it, use the inverted CDF to generate a ...

environ 13 ans il y a | 1

| A accepté

Réponse apportée
Values of intersection points of plot. Print results.
If your x is the output of an ODE solver, then it might not hit x2 = 1 exactly and you will need to interpolate. You could us...

environ 13 ans il y a | 3

| A accepté

Réponse apportée
Large Sparse Matrix Summation
This seems to work well: % Making some random data... N = 1000; K = 100; A = sprand(N*K,N,0.0001); [r,c,val...

environ 13 ans il y a | 2

| A accepté

Réponse apportée
updating a second matrix in specific lines as you loop through a first one
There is also the very useful ACCUMARRAY command: AAA = [ 1 100 102 4 55 58 11 33...

environ 13 ans il y a | 0

Réponse apportée
How to force slope to be zero at a particular point using function PolyFit?
If you have LSQLIN in the Optimization Toolbox, this can be done with a little bit of effort, as described here <http://www.ma...

environ 13 ans il y a | 1

Réponse apportée
how to plot magniture and phase response of a filter?
You need to do elementwise division, use "./" instead of "/" Hw=(0.1*(exp(1j*w)-1))./(exp(1j*w)+0.8);

environ 13 ans il y a | 0

Réponse apportée
Construct a reference to a matrix where the matrix name is the value of a variable
If you need to reference a variable with a dynamic name based on a string, you'd generally call EVAL. That being said, doing the...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Sparse Matrix - More Efficient Assignment Operation
The performance of sparse matrix indexing was enhanced in R2011a. <http://www.mathworks.com/help/matlab/release-notes.html> ...

environ 13 ans il y a | 1

Réponse apportée
How many times does each number appear?
Assuming that the second column of a is always >= the first column of a, then this is an efficient solution. mA = max(a(:));...

environ 13 ans il y a | 5

| A accepté

Réponse apportée
Performance Issue of 'imrotate' in double precision mode
Hi Dehuan, If you are able to upgrade to a newer version, performance improvements for IMROTATE were implemented in R2012b. M...

environ 13 ans il y a | 1

Réponse apportée
How to average a multidimensional array with surroundings
This would be much simpler if it were not for that weird edge case. Anyways, this is how you would do it in the case of an arbit...

environ 13 ans il y a | 0

Réponse apportée
How to find length of branch in a skeleton image?
You can first find the branch points and endpoints using BWMORPH, and then call BWDISTGEODESIC to get the distance from the bran...

environ 13 ans il y a | 0

Réponse apportée
Flip last 3 bits of vector
You can use BITXOR, V = uint16( round(65535*rand(5,1)) ); V2 = bitxor(V,1+2+4); % 1+2+4 = 7 = 0000000000000111 de...

environ 13 ans il y a | 3

| A accepté

Réponse apportée
Help on for loop
No need to iterate. MATLAB makes this simple with logical indexing. U = [0.0137;0.0081]; R = [0;0;0;72;0;90]; U_f...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Vectorized Solution to Rotate Multiple Points each at a Different Angle
This vectorized solution uses complex exponentials and works about 2 orders of magnitude faster for large vectors. M = exp(...

environ 13 ans il y a | 4

| A accepté

Réponse apportée
how to filter points which are on a straight line
F = [1 1; 2 2; 3 3; 4 5; 5 5; 6 6; 7 7]; dydx = diff(F(:,2))./diff(F(:,1)); F(1 + find(diff(dydx)==0) ,:) = []

environ 13 ans il y a | 0

Réponse apportée
preallocating sparse 4d matrix
You can't make a sparse array with more than 2 dimensions, but you could make a 100x100 cell array that is filled with 100x100 s...

environ 13 ans il y a | 0

Réponse apportée
Can we run simulink by m file when simulink interface is not opened
Yes, you can use the LOAD_SYSTEM command to load the model into memory without bringing up the Simulink interface, for example: ...

environ 13 ans il y a | 2

| A accepté

Réponse apportée
Matlab: find the contour and straighten a nearly rectangular image
I've done this before: <http://www.mathworks.com/videos/solving-a-sudoku-puzzle-using-a-webcam-68773.html> This is the strat...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
How do I move a cloud of points in 3D so that they are centered along the x-axis?
%% Step 1. Center the data at zero: xyz0=mean(XYZ); A=bsxfun(@minus,XYZ,xyz0); %center the data scatter3(A(:,1),A(:,2...

environ 13 ans il y a | 2

| A accepté

Réponse apportée
Image processing GLCM gray level cooccurance matrix
It's just the default setting. You can change the size by using the 'NumLevels' parameter. For example, I = imread('pou...

environ 13 ans il y a | 0

Charger plus