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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 1

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 1

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

etwa 6 Jahre vor | 1

| akzeptiert

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

etwa 6 Jahre vor | 2

| akzeptiert

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

etwa 6 Jahre vor | 1

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

Beantwortet
Transform char variable to matrix
tmp={'002,005';'002,003';'002,005'}; NewVar=str2double(split(tmp,','))

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

Mehr laden