已回答
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...

11 years 前 | 0

已回答
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...

11 years 前 | 1

已回答
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);

11 years 前 | 0

已回答
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...

11 years 前 | 0

| 已接受

已回答
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> ...

11 years 前 | 1

已回答
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(:));...

11 years 前 | 5

| 已接受

已回答
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...

11 years 前 | 1

已回答
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...

11 years 前 | 0

已回答
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...

11 years 前 | 0

已回答
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...

11 years 前 | 3

| 已接受

已回答
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...

11 years 前 | 0

| 已接受

已回答
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(...

11 years 前 | 4

| 已接受

已回答
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) ,:) = []

11 years 前 | 0

已回答
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...

11 years 前 | 0

已回答
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: ...

11 years 前 | 2

| 已接受

已回答
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...

11 years 前 | 0

| 已接受

已回答
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...

11 years 前 | 2

| 已接受

已回答
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...

11 years 前 | 0

已回答
Avoiding for loops problem
If you have the Statistics Toolbox, you can use the PDIST2 function. It is very fast. A = rand(200,100); B = rand(300,10...

12 years 前 | 1

已回答
Simulink Decreasing Constant over Time
Here are two ways to do it: 1. [Ramp] --> [Saturation] --> 2. Use the Signal Builder block (works for more complicated pie...

12 years 前 | 0

| 已接受

已回答
Deleting rows and columns of all zeroes in a symbolic matrix
syms x1 data = [ x1, 1, 0 ; 0, 0, 0 ; 0, 1, 0] data( all( isAlways(data==0) ,2) ,:) = [] data( : ,all( isAlways(data=...

12 years 前 | 0

| 已接受

已回答
Vectorization of product of flipped vectors
Faster for long vectors, slower for short ones: r = conv(r1,r2); r = r(1:numel(r1));

12 years 前 | 0

| 已接受

已回答
Use interp2 for many simultanious 1D operations?
As others have also pointed out, this is *REALLY* not what INTERP2 is meant to do. In fact if anything, since there are 3 variab...

12 years 前 | 0

已回答
Common Volume/Intersection Volume between two Delaunay Triangulations
Sounds like a difficult problem to do exactly/analytically. I think you can get a very good approximation using a much simpler m...

12 years 前 | 1

已回答
using lsqlin when you have a large matrix
I don't think there is anything wrong with this code, except LSQNONNEG would be easier. coef = lsqlin(x,yt2,-a,-b); is t...

12 years 前 | 0

| 已接受

已回答
Volume integration under surface fitting
Since your points only cover that parabolic looking region in X-Y, how is MATLAB supposed to know what the values of the functio...

12 years 前 | 0

| 已接受

已回答
how find ramp response
You could get the ramp response by dividing your transfer function by s, and then taking the step response. For example: ...

12 years 前 | 14

| 已接受

已回答
discrete second order derivative operator for unequally spaced data
Could you possibly use the GRADIENT command? This allows you to pass in unevenly spaced values for X and Y. help gradient

12 years 前 | 0

已回答
Integrating a multivariate function w.r.t. a single variable
Define another function handle to be the integral over y. Like this: % Just making some random 2d function f = @(x,y) (x...

12 years 前 | 4

| 已接受

已回答
If I have a 3d matrix(A), how can i check if a given 2d matrix(B) is one of matrix A's pages?
Given a 3d matrix A: A = cat(3, [1 2; 3 4], [5 6; 3 4], [5 6; 1 2]) And some 2d matrix B B = [5 6; 3 4] Then, th...

12 years 前 | 2

加载更多