Réponse apportée
Could anyone help me how to make the values to be repeated again after 800 iterations for a total of 1000 iterations.
If I understand you correctly, you have data in, let's say, x. You want to set elements 801-1000 of x equal to element 800: x(8...

presque 6 ans il y a | 0

Réponse apportée
Colormap for multline plot
I believe this should work: mylines = plot(t, x); set(mylines,{'Color'},flag(length(mylines))) For 2019b+, colororder is ...

presque 6 ans il y a | 0

Réponse apportée
how to find duration of peak; starting and ending points
widths are an optional output from findpeaks: [pks,locs,widths,~] = findpeaks(data);

presque 6 ans il y a | 0

Réponse apportée
How to convert .mat file to png format?
This is not generally possible. mat files store variables, not images. This is like asking "how do I convert a flashdrive into a...

presque 6 ans il y a | 0

Réponse apportée
Save variables in a folder
Check the save documentation, you can save specific variables by adding their names as further inputs: save(resultFileName,'Err...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Why it gives Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters
This would be much easier to solve if you included the full error text. But, I suspect the problem is here: function H = hpfil...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Delete and merge rows and columns based on values of other matrix
If I understand correctly: You have one NxN matrix A And a second 1xN vector B When an element of B is zero, you delete rows ...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Could anyone please help me to do matrix multiplication with respect to the sample data given below.
Matrix multiplication only works when the "middle" dimension matches ( N x M ) * ( M x O ) Check the sizes of your matrices: >...

presque 6 ans il y a | 0

Réponse apportée
Could anyone help me how to multiply the second and third element of the row in a matrix by an value of 2 and 3.
A=[ 2 3 4]; A(2) = A(2)*2; A(3) = A(3)*3; More generally, you can use elementwise multiplication: A=[ 2 3 4 5 6 7 8];...

presque 6 ans il y a | 0

Réponse apportée
How can I create array of numbers +5 the previous number?
start_num = 1; end_num = 15; x=[start_num:5:end_num]; % note that 15 is not included since 1+5+5+5=16 If you actually want t...

presque 6 ans il y a | 0

Réponse apportée
How can I xticks at equal distance
Assuming you want them equally spaced because they are equally spaced on a log scale: semilogx(F_x,K) xticks([0.1 1 10])

presque 6 ans il y a | 0

Réponse apportée
Calculating the eigenvalues of a composite matrix
You are overwriting V,D,W every time. The simplest way to avoid this, ignoring the specific size of the variables, is to put the...

presque 6 ans il y a | 1

| A accepté

Réponse apportée
How to save a table as a CSV in a folder within the directory
writetable(T,'subfolder/myData.csv','Delimiter',',') if 'subfolder' doesn't already exist, you may need to make it: mkdir('sub...

presque 6 ans il y a | 0

Réponse apportée
I'm trying to create a matrix with the following format for any size square matrix.
I believe this spdiags example is exactly what you want: https://www.mathworks.com/help/matlab/ref/spdiags.html#mw_28033fbc-1469...

presque 6 ans il y a | 0

Réponse apportée
How can I replace the maximum value in every column in matrix A (38 x 13390) by 1 in matrix B (38 x 13390) in the same cell of every column in matrix A
A=rand(38,13390); % find the max elements M for each column and the indices I % 'linear' returns linear indices instead of row...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Coding a quadratic root finder
One error: you want to check the sign of (b*b-4*a*c), not sqrt(b*b-4*a*c) The case of two complex roots works exactly like tw...

presque 6 ans il y a | 0

Réponse apportée
How can I generate a colour map of points based on their distance from a plane?
I haven't tested, but I think something like this should work: % bin b1 & b2 into 10 & 30 bins, respectively [b1_bin,b1_edge] ...

presque 6 ans il y a | 0

Réponse apportée
Is there a way to put a marker on all of the points where y=0 on a plot?
Assuming you have access to the data (x,y) which generated the plot: % generate sample x,y x=1:1000; % generate 1000 random i...

presque 6 ans il y a | 0

Réponse apportée
indexing into a matrix
A([1 3 end-1],:) I highly recommend this explanation of indexing: https://www.mathworks.com/company/newsletters/articles/matrix...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
aggregate data of a dataset
check out splitapply. You may need to change the format of your data, but it does exactly what you want: G = findgroups(ds.seat...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Array indices must be positive integers or logical values.
You are trying to access Re(i),V(i),etc. with i=1.02. There doesn't seem to be anywhere that you use i as a number rather than i...

presque 6 ans il y a | 1

Réponse apportée
How do I replace an image on a graph and replace it with a new image, whilst keeping all other images in their place?
ball_handle = fill(x,y,c); %or secondhand through drawshapeNew ... ball_handle.Vertices = ball_handle.Vertices + [xtranslate y...

presque 6 ans il y a | 1

| A accepté

Réponse apportée
how to Obtain the algebraic and geometric multiplicity of each eigenvalue of any square matrix
eig(A) gives you the eigenvalues. You can count occurrences for algebraic multiplicity. Geometric seems more complicated, but I ...

presque 6 ans il y a | 2

| A accepté

Réponse apportée
How do I replace an image on a graph and replace it with a new image, whilst keeping all other images in their place?
Depending on how you are drawing the ball, you may be able to update it's position rather than drawing a new one. If not, you co...

presque 6 ans il y a | 1

Réponse apportée
using break and continue to using true extend ?
It sounds like you want to check the conditions with if statements inside your while loop: while true % do stuff Mass...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
using non number vectors and number vectors in the same fprintf command (beginner)
There is no good reason to do this in a single fprintf command, and the workaround necessary to do it would be painful. Do this:...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
changing a group of numbers in a vector
Does this do it or do you need individual cycles to be different lengths? % total number of elements N = 3501; % number of "o...

presque 6 ans il y a | 0

Réponse apportée
Random Number Generator with range between numbers
instead of (weighted) averaging your old velocity and a new random velocity, just modify your old velocity by a smaller random n...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Transform char variable to matrix
tmp={'002,005';'002,003';'002,005'}; NewVar=str2double(split(tmp,','))

presque 6 ans il y a | 0

Réponse apportée
How to plot and save a figure with consolidated plots as well as splitted plots in loop?
Presumably you are calculating or loading each batch. To distinguish in this simple example, I add the index to the data x=[1:5...

presque 6 ans il y a | 0

Charger plus