Frage


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

mehr als 6 Jahre vor | 1 Antwort | 0

1

Antwort

Beantwortet
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,:))...

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 2

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

Frage


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

mehr als 6 Jahre vor | 1 Antwort | 0

1

Antwort

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

Beantwortet
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;

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 5

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

Beantwortet
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. [~...

mehr als 6 Jahre vor | 2

| akzeptiert

Frage


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

mehr als 6 Jahre vor | 1 Antwort | 0

1

Antwort

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

mehr als 6 Jahre vor | 8

Beantwortet
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,:...

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 0

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

etwa 7 Jahre vor | 1

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

etwa 7 Jahre vor | 0