Question


using conditional statements inside cellfun
Suppose I have two cell arrays |X| and |Y|. If |Y{i}| satisfies a condition, I want to transform |X{i}| into some |X'{i}|, other...

environ 7 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
Hi..I would like to plot a 2D plot for 15 to 20 data points with 15 to 20 different color ..how can I do it?
Nswarms = 20; cmap = colormap(jet(Nswarms)); for i=1:Nswarms hold on; plot(tictoc(i),Jopt(i),'*','Color',cmap(i,:))...

environ 7 ans il y a | 0

| A accepté

Réponse apportée
How does regress deal with NaN?
Type this on your command window: open regress If you scroll down to |line 65| (might be a bit different depending on y...

environ 7 ans il y a | 2

| A accepté

Réponse apportée
How can I take an average of a signal in order to smooth the data?
Let |t| be the set of time points, |y| your signal, and |fs| be the sampling rate. [~,peaks] = findpeaks(y,'MinPeakHeight'...

environ 7 ans il y a | 0

| A accepté

Réponse apportée
Generationf of uniform random
This should work: N=10; % number of random numbers success = false; while ~success x = rand(N,1); [minva...

environ 7 ans il y a | 0

Réponse apportée
How to find are under the curve for a random signal.
If samples are all uniformly spaced in time, you just need to take the sum of all elements. area_under_signal = sum(my_sign...

environ 7 ans il y a | 0

| A accepté

Réponse apportée
How to write the difference quotient in matlab?
x = linspace(-2*pi,2*pi); h = .01; hold on; plot(x,sin(x).^2 + 4*x); plot(x,((sin(x+h).^2 + 4*(x+h)) - (sin(x).^2 + 4...

environ 7 ans il y a | 0

Question


splitting an array into unequal parts without loop
Given: v_in = rand(1,100); % length = 100 n = [10 20 10 10 15 25 10]; % length = 7 I want to cut the array |v_in| int...

environ 7 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
Subtracting values in a matrix
The problem is with this expression in the |if| statement: if abs(matrix10(i,j) - matrix10(i,:)) >= 2 The left hand side...

environ 7 ans il y a | 0

Réponse apportée
writing if statement using probabilities
Assuming you already have y, ymaybe, t and s: if t > s y = ymaybe; % ymaybe becomes the new y else pr = exp...

environ 7 ans il y a | 0

| A accepté

Réponse apportée
How to get more precise cdf pdf plot?
By default |hist| uses 10 bins to create a histogram. You can change the resolution either by specifying the number of bins or t...

environ 7 ans il y a | 0

| A accepté

Réponse apportée
'Load()' function cannot open a file though it exists
Your code is looking for a file called |location| which obviously doesn't exits. You need to use location as a variable name: ...

environ 7 ans il y a | 0

| A accepté

Réponse apportée
How can I define a 1x3 array with "unifrnd" while second element must always be greater than first one?
minvals = min(A(:,1:2),[],2); maxvals = max(A(:,1:2),[],2); A(:,1) = minvals; A(:,2) = maxvals;

environ 7 ans il y a | 1

| A accepté

Réponse apportée
Draw Pdf and Cdf for the given data
[p,x] = hist(sample1); plot(x,p/sum(p)); %PDF [f,x] = ecdf(sample1); plot(x,f); %CDF Ckeckout |help hist| to see how to ...

environ 7 ans il y a | 5

| A accepté

Réponse apportée
Storing Values From a Loop
Replace s=3*(q/a)*sin(t)^2-(c*(1+y)^1.5)/a y=y+s with s=3*(q/a)*sin(t)^2-(c*(1+y(end))^1.5)/a; y...

environ 7 ans il y a | 1

| A accepté

Réponse apportée
Find Minimum based on new criteria
minval = min(A(A(:,5)==1,3)) rowindx = find(A(:,3)==minval)

environ 7 ans il y a | 0

Réponse apportée
How to calculate a period of a wave when you don't have the equation of the wave
You can use |findpeaks| to detect the peaks in your wave and then use the spacing between peaks to determine periodicity. [~...

environ 7 ans il y a | 2

| A accepté

Question


Inappropriate MATLAB warning when summing over columns
Suppose X is an Nx10 matrix and I want to sum over each of the 10 columns, regardless of number of rows. I use: Y = sum(X);...

environ 7 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
Is it possible to set marker line width?
scatter(X,Y,'+','LineWidth',2)

environ 7 ans il y a | 8

Réponse apportée
Extracting rows from a matrix based on values in columns
for n=2:4, C_temp(:,n-1) = accumarray(A(:,1),A(:,n),[],@(n){n}); end for m=1:size(C_temp,1), C{m} = cell2mat(C_temp(m,:...

environ 7 ans il y a | 1

Réponse apportée
Need help with Least Squares fit problem! Not overly difficult I don't believe.
regress(Y,X)

environ 7 ans il y a | 0

Réponse apportée
Find maxima every n positions in 3D matrix
Here's one with while loop. There's probably a faster way. stepsize = 12; count = 1; i=1; while i<=size(mymatrix,3) ...

environ 7 ans il y a | 1

Réponse apportée
how I do data gridding ?
Did you try this? load('grid.mat'); [LAT,LON] = meshgrid(lat,lon);

plus de 7 ans il y a | 0

Réponse apportée
How to plot a variable with 3 dimensions.
Even if you get Matlab to make a dense 3d plot, you cannot see through the surface so it might be futile. One alternative is to ...

presque 8 ans il y a | 0

Réponse apportée
Request for Guidance about the sign of Singular Value Decomposition
The sign ambiguity of SVD output is well known. SVD does not have a unique answer because changing the signs of the correspondin...

presque 8 ans il y a | 0

Réponse apportée
Optimization of dot product of Matrix and vector
Sounds like you only care about the direction of L and not length. So instead of minimising f(M*L), you could minimise f((M*L)/n...

presque 8 ans il y a | 0

Réponse apportée
Split cell based upon logical value
You can treat your cell array like a matrix. So if X is your nx5 cell array, truecells = X([X{:,5}],1:4); falsecells...

presque 8 ans il y a | 1

Réponse apportée
Using Variable inside For loop Iteration
You're probably getting the error because of the line obstnew2(i+(particle_rad),-j) = 3. You have "minus j" which makes the inde...

presque 8 ans il y a | 0