Answered
Stop needing VPA to display decimal answers
Use the <https://www.mathworks.com/help/symbolic/double.html *|double|*> (link) function.

9 years ago | 0

Answered
Creating a txt file with different types of data stored in each column?
If you have *|R2013b|* or later, create the cell array, then use the *|cell2table|* function to create a table, then use *|write...

9 years ago | 0

Answered
Matrix dimensions must agree.
Yes, they must. However you can get round that restriction by using the *|meshgrid|* function: n = 0:1:10; t = 0:0...

9 years ago | 1

| accepted

Answered
Creating a symmetric matrix from a single column vector
That same example is in the documentation for the <https://www.mathworks.com/help/matlab/ref/toeplitz.html *|toeplitz|*> functio...

9 years ago | 0

| accepted

Answered
Counting lines on the y axis
I still have no idea what you’re asking. See if one of these works for you: x = 1:10; y = rand(1, 10); ...

9 years ago | 0

Answered
How to write audio without data clipping?
Try this to normalise the signals before you write them: t = 0:99; % Time Vector (For Pl...

9 years ago | 2

| accepted

Answered
To find the 2nd MINIMUM and/or the MAXIMUM value(s) from a Matlab Plot
If you have *|R2017b|*, the <https://www.mathworks.com/help/matlab/ref/islocalmax.html *|islocalmax|*> (link) and *|islocalmin|*...

9 years ago | 0

Answered
What parts of MATLAB would you not miss?
*@Greg —* Thank you for reviving this thread. I didn’t know it existed. For me, it would be _‘automatic array expansion’_...

9 years ago | 0

Answered
How do I create an array with unequal increment?
Try this: expspace = @(vmin,vmax,inc) vmin * inc.^(0:( log(vmax/vmin)/log(inc))); vmin = 2; vmax = 256; inc =...

9 years ago | 3

| accepted

Answered
How can I use a string as a function parameter?
The easiest way is probably to use *|sscanf|*: mc = '(1.2, 0.)'; mn = sscanf(mc, '(%f,%f)')'; mz = complex(mn(:,1), ...

9 years ago | 0

Answered
How to identify and get the average of local maximum negative peaks for a set of data?
If you have *|R2017b|*, see if the <https://www.mathworks.com/help/matlab/ref/islocalmin.html *|islocalmin|*> (link) function wi...

9 years ago | 1

| accepted

Answered
how to make non linear model fitting ?
Try this: W = [4.0 2.7 1.4 0.9; 4.0 3.0 1.4 1.2; 4.0 3.0 2.7 2.0]; T = [ 0 15 30 60; 0 15 45 90; ...

9 years ago | 0

| accepted

Answered
how to delete this error??
The *|subplot|* indexing obeys the same rules as matrix indexing, that is the indices must be integers greater than *|0|*. You ...

9 years ago | 0

Answered
How Can i get MATLAB to plot date on x-axis?
If you have *|R2014b|* or later, consider using a <https://www.mathworks.com/help/matlab/ref/datetime.html *|datetime|*> (link) ...

9 years ago | 0

Answered
How to sum a specified portion of a column in a data table?
Use the <https://www.mathworks.com/help/matlab/ref/varfun.html *|varfun|*> (link) function: C = varfun(@sum,B(31:57,2)); ...

9 years ago | 4

| accepted

Answered
How to write exponential function that accepts vectors ?
You have to use <https://www.mathworks.com/help/matlab/matlab_prog/vectorization.html *Vectorization*> (link) to do element-wise...

9 years ago | 0

Answered
What is wrong with my code? it returns the error "In an assignment A(:) = B, the number of elements in A and B must be the same."
You have defined *|‘ta’|* as a _scalar_, and since it never changes, there is no reason to subscript it. Change the *|‘z’|*...

9 years ago | 1

| accepted

Answered
Storing variables from a for loop
Subscript *|‘x’|* and *|‘y’|*: The loop becomes: for k = 1:numel(x) if (x(k) < -3 | x(k) > 3) ...

9 years ago | 0

Answered
I have a calculation error and don't know what's wrong?
Use *|log10()|* rather than *|log()|*.

9 years ago | 0

| accepted

Answered
How do i band a vector into sized brackets
I am not certain what you are referring to. Two possibilities: R(i,:) = [1 2 3 4 5 6 7]; V1{i} = R(i, (R(i,:)>...

9 years ago | 0

| accepted

Answered
how to exclude a row based on a column value?
Try this: M_edited = M((M(:,3)>=1) & (M(:,3)<=12), :); It assigns only the rows in *|‘M’|* with months from *|1|* to *|...

9 years ago | 0

| accepted

Answered
Using trapz function to find area of two vectors
Try this: Work = trapz(Time, Power)

9 years ago | 0

Answered
Why is my plot inside the loop not working?
The default behaviour of *|plot|* is to connect two points with a line. If it only gets one point, it plots nothing. If you gi...

9 years ago | 1

| accepted

Answered
Simple mathematics giving unexpected outcome. Dividing data arrays/vectors
MATLAB maintains full internal precision in its calculations. Since *|2.578|* and *|2.5803|* are not significantly different, I...

9 years ago | 1

| accepted

Answered
Showing Legend of Plot of Array?
Try this: figure(1); plot(t,Y1); lgnd = regexp(sprintf('Line %d = [%.1f %.1f]\n', [(1:3)' A B]'), '\n', 'split'); ...

9 years ago | 0

| accepted

Answered
Index exceeds matrix dimensions
If her code runs and yours doesn’t, yours and hers aren’t the same. I *_suspect_* the problem may be here: hipangle =...

9 years ago | 0

Answered
Storing the values of a for loop
Assign *|‘ze’|* _before_ the loop, then index with reference to it: ze = 0.1:0.1:1.2; for k = 1:numel(ze) v(k) =...

9 years ago | 0

Answered
Obtain a function to give y with a given x from interpolation
I would use the <https://www.mathworks.com/help/matlab/ref/interp1.html *|interp1|*> (link) function. Your data would have ...

9 years ago | 0

Answered
cell to double using cell2mat
I’m _guessing_ here, because I don’t have an example of your data. Dates and times are frequently imported as character arr...

9 years ago | 0

| accepted

Answered
Script that determine how many times conditions were met
Try this: data2=[5 5;5 5;5 5;5 5;37 0.2;38 0.2;38 0.2;39 0.2;5 5]; test = (data2(:,1) >= 35) & (data2(:,2) <= 0.25)...

9 years ago | 0

Load more