Respondida
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...

casi 13 años hace | 1

Respondida
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...

casi 13 años hace | 0

| aceptada

Respondida
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=...

casi 13 años hace | 0

| aceptada

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

alrededor de 13 años hace | 0

| aceptada

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 1

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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: ...

alrededor de 13 años hace | 14

| aceptada

Respondida
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

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 4

| aceptada

Respondida
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...

alrededor de 13 años hace | 2

Respondida
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...

alrededor de 13 años hace | 0

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

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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);

alrededor de 13 años hace | 1

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 0

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

alrededor de 13 años hace | 1

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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{:})

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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...

alrededor de 13 años hace | 0

| aceptada

Respondida
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)...

alrededor de 13 años hace | 0

| aceptada

Respondida
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...

alrededor de 13 años hace | 0

Respondida
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 ...

alrededor de 13 años hace | 1

Respondida
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...

alrededor de 13 años hace | 1

| aceptada

Respondida
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 ...

alrededor de 13 años hace | 0

| aceptada

Cargar más