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

environ 13 ans il y a | 1

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

environ 13 ans il y a | 0

| A accepté

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

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Vectorization of product of flipped vectors
Faster for long vectors, slower for short ones: r = conv(r1,r2); r = r(1:numel(r1));

environ 13 ans il y a | 0

| A accepté

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

environ 13 ans il y a | 0

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

environ 13 ans il y a | 1

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

environ 13 ans il y a | 0

| A accepté

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

environ 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 14

| A accepté

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

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 4

| A accepté

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

plus de 13 ans il y a | 2

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

plus de 13 ans il y a | 0

Réponse apportée
Find Critical Mach number graphically
You probably just need to change "/" to "./" Remember, the dot indicates elementwise operations. This works: 1./[1 2...

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 1

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

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 0

Réponse apportée
Creating a spherical matrix
Something like this? Rx = 1; %<-- Change these to make an ellipse instead Ry = 1; %<-- Change these to make an ellipse ...

plus de 13 ans il y a | 1

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

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
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{:})

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 1

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

plus de 13 ans il y a | 1

| A accepté

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

plus de 13 ans il y a | 0

| A accepté

Charger plus