提问


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

7 years 前 | 1 个回答 | 0

1

个回答

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

7 years 前 | 0

| 已接受

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

7 years 前 | 2

| 已接受

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

7 years 前 | 0

| 已接受

已回答
Generationf of uniform random
This should work: N=10; % number of random numbers success = false; while ~success x = rand(N,1); [minva...

7 years 前 | 0

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

7 years 前 | 0

| 已接受

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

7 years 前 | 0

提问


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

7 years 前 | 1 个回答 | 0

1

个回答

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

7 years 前 | 0

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

7 years 前 | 0

| 已接受

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

7 years 前 | 0

| 已接受

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

7 years 前 | 0

| 已接受

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

7 years 前 | 1

| 已接受

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

7 years 前 | 5

| 已接受

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

7 years 前 | 1

| 已接受

已回答
Find Minimum based on new criteria
minval = min(A(A(:,5)==1,3)) rowindx = find(A(:,3)==minval)

7 years 前 | 0

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

7 years 前 | 2

| 已接受

提问


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

7 years 前 | 1 个回答 | 0

1

个回答

已回答
Is it possible to set marker line width?
scatter(X,Y,'+','LineWidth',2)

7 years 前 | 8

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

7 years 前 | 1

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

7 years 前 | 1

已回答
how I do data gridding ?
Did you try this? load('grid.mat'); [LAT,LON] = meshgrid(lat,lon);

7 years 前 | 0

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

8 years 前 | 0

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

8 years 前 | 0

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

8 years 前 | 0

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

8 years 前 | 1

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

8 years 前 | 0