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

meer dan 6 jaar ago | 1 answer | 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,:))...

meer dan 6 jaar ago | 0

| accepted

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

meer dan 6 jaar ago | 2

| accepted

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

meer dan 6 jaar ago | 0

| accepted

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

meer dan 6 jaar ago | 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...

meer dan 6 jaar ago | 0

| accepted

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

meer dan 6 jaar ago | 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...

meer dan 6 jaar ago | 1 answer | 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...

meer dan 6 jaar ago | 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...

meer dan 6 jaar ago | 0

| accepted

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

meer dan 6 jaar ago | 0

| accepted

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

meer dan 6 jaar ago | 0

| accepted

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;

meer dan 6 jaar ago | 1

| accepted

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

meer dan 6 jaar ago | 5

| accepted

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

meer dan 6 jaar ago | 1

| accepted

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

meer dan 6 jaar ago | 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. [~...

meer dan 6 jaar ago | 2

| accepted

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

meer dan 6 jaar ago | 1 answer | 0

### 1

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

meer dan 6 jaar ago | 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,:...

meer dan 6 jaar ago | 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) ...

meer dan 6 jaar ago | 1

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

meer dan 6 jaar ago | 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 ...

meer dan 7 jaar ago | 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...

meer dan 7 jaar ago | 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...

meer dan 7 jaar ago | 0