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

已回答
Polynomial fitting of each pixel in an image without looping
Here's an approach using sparse matrices to do it. this works in about 0.3 seconds for me, and gives the coefficients in a 5x655...

12 years 前 | 0

已回答
Find Critical Mach number graphically
You probably just need to change "/" to "./" Remember, the dot indicates elementwise operations. This works: 1./[1 2...

12 years 前 | 0

已回答
Calculating integral but weird result :S
When sigmaZ is negative, the integrand blows up around x = 0.3 and x = 2.7 and you have a singularity which you cannot integrate...

12 years 前 | 0

| 已接受

已回答
get line plot data just by mouse stay on it (without click)
Here is a simple example that outlines how to do it using HITTEST. function my_example plot(rand(5)); set(gcf,'wi...

12 years 前 | 0

| 已接受

已回答
Matlab matrix operations without loops
Your entire script is equivalent to this: M_MAX = 1000; N_MAX = 2000; YTemp = (1:M_MAX)'*(1:N_MAX);

12 years 前 | 1

已回答
how can I select a part of data with dual cousors and get the average in a curve?
I think the simplest way to do this would be to use the brush feature. 1. Plot your data 2. From the figure toolbar, selec...

12 years 前 | 0

已回答
continuous search of the closest rows in a matrix
If you have the Statistics Toolbox installed, instead of using PDIST2, use PDIST (along with SQUAREFORM) instead. It is designed...

12 years 前 | 0

已回答
Creating a spherical matrix
Something like this? Rx = 1; %<-- Change these to make an ellipse instead Ry = 1; %<-- Change these to make an ellipse ...

12 years 前 | 1

已回答
were to introduce hold on command
You keep overwriting "nim" with the same original "k". You can fix it easily: *Step 1.* Change these lines: ok = 0; w...

12 years 前 | 0

| 已接受

已回答
Double integral with singularity
I will change my earlier comment into an answer: Look at these two lines: funGLA = quad2d(GLA, 0.05, ta(mt), xi(1), xi(en...

12 years 前 | 0

| 已接受

已回答
how to block diagonalize a 3D matrix
R = rand(4,2,3); M = mat2cell(R,4,2,ones(1,size(R,3))); M = blkdiag(M{:})

12 years 前 | 0

已回答
problem with calculation of percentage of colormap
You don't need to loop over every element one by one to do this. MATLAB is very good at doing operations on entire matrices in o...

12 years 前 | 0

已回答
The error 'Matrix dimensions must agree' during optimization.How can it be solved?
The problem occurs when K1 is negative. The ODE solver blows up before it can integrate to all your time values. You should spec...

12 years 前 | 0

| 已接受

已回答
Coherence of two signals
The coherence is a function of frequency, and in general it will not have the same number of elements as the original (split up)...

12 years 前 | 0

| 已接受

已回答
parameterized function of quadgk with another array input argument
You could try to use an ODE solver instead of just a scalar integration function. For example. %% Just make some random array...

12 years 前 | 0

已回答
how to print the values of each bar on top of it; multibar and subplots
Would something like this work? Data1 = [1 2 0 3 4]; Data2 = [2 3 4 5 5]; hb = bar([Data1;Data2]); % Find the ...

12 years 前 | 1

已回答
How to plot a second graph instead of color-coding
Assumung your XY data are smooth, you can find the normal vector at each point, and then offset in that direction, like the code...

13 years 前 | 1

| 已接受

已回答
help me to solve this second order non-linear differential eq?
Well you're almost there Rewrite this: y(2)=y'(1) y'(2)+a*sign*y'(1)*|y'(1)|^1.8+by(1)-c*sin(wt)=0 Like ...

13 years 前 | 0

| 已接受

加载更多