Answered
How to add a small random number to all values in a matrix
Try this: A = YourArray [M,N] = size(A); A = A + 0.2*rand(M,N)-0.1; Experiment to get the result you want.

8 years ago | 1

Answered
Indexing error message that makes no sense with cfit
My _guess_ is that the error refers to *|fit|*, and MATLAB believes it’s an array, not a function. Do you have a previously ass...

8 years ago | 0

| accepted

Answered
How can I plot mutiple time series with different starting and ending timestamps in same graph
I’m _guessing_ as to what the problem is. I suspect that you’re seeing the _last_ timestamps, since subsequent *|plot|* calls t...

8 years ago | 0

Answered
The expression to the left of the equal sign is not a valid target for an assignment
I get a different error in *|R2018a|*, specifically about: while a = 0 Relational operators involving ‘equal’ require _...

8 years ago | 0

| accepted

Answered
Multi sine waves function
I’m not certain what result you want. Your posted code doesn’t show any oscillations when I run it. I would change the arg...

8 years ago | 1

| accepted

Answered
Trouble using ode45
The *|‘Too many input arguments’|* error comes from the ODE functions requiring both the independent and dependent variables as ...

8 years ago | 0

Answered
How can I use one of the 3-D plot functions on the MATLAB to plot multiples 3-D polygons? Thank you
Try this: l = 5; % Length w = 5; ...

8 years ago | 0

| accepted

Answered
How to only plot data points within a certain range?
One approach: x = randi(50, 1, 50); % Create Data y = randi(50, 1, 50); ...

8 years ago | 2

Answered
how can I ignore the initial part of a data observation?
One option is: x = x(y > -1.5); y = y(y > -1.5); You may have to experiment with the threshold in different data set...

8 years ago | 1

Answered
What is the difference between .' and ' when transposing a matrix?
They produce the same result only for _real_ values. The ‘regular’ transpose operator *|(')|* produces a _complex-conjugate_ tr...

8 years ago | 5

| accepted

Answered
I have a function and I would like for it to print out an answer if I feed it a value.
Probably the easiest way is to have the Symbolic Math Toolbox solve for *|‘Re’|*, then do the calculations in an anonymous funct...

8 years ago | 0

| accepted

Answered
How to solve "equation with fractional power" using Matlab??
You need to use the ellipsis *|‘...’|* continuation operator in this line: eqn_LHS=bast/(mqam_part1+mqam_p...

8 years ago | 1

| accepted

Answered
interpolation of scatter data
Your data are gridded, so you simply need to *|reshape|* the vectors to create matrices: % Id Iq Fd Fq M = [ 0 0 0...

8 years ago | 0

| accepted

Answered
I have to plot 3 curves on a single graph.
Try something like this: tf=vy/g; %time the ball is in the air (s) t = (0:0.1:2)' * tf; ...

8 years ago | 0

| accepted

Answered
3d matrix to 2d matrix
I would use the *|reshape|* function: B = reshape(A, [], 1); You may have to experiment with it to get the result you w...

8 years ago | 0

Answered
Why am I getting a parse error at the logical operator &&?
You’re not incrementing the loop. Try this: m1 = randi([-1 1], 20, 1); % Create Data ...

8 years ago | 0

| accepted

Answered
Estimation of the amplitude of a signal
It depends on what you want. There are two commonly-used measures of ‘amplitude’, peak-to-peak and root-mean-square: t = ...

8 years ago | 0

Answered
Displaying two different variable legends in the same figure
You can only plot one legend in each *|axes|* object. With that restriction, you can plot them as *|1|* row and *|2|* colum...

8 years ago | 0

Answered
Changing colour of title in plots
You simply need to tweak your existing *|title|* call. Put each as a separate string in a cell array: title({'\color{mage...

8 years ago | 0

| accepted

Answered
I don't know why it keeps saying illegal use of "case"
If I understand what you want to do, using: switch alloyname would probably produce the desired behaviour.

8 years ago | 0

Answered
How do I find sine wave frequencies in a signal using fft?
See: <https://www.mathworks.com/help/releases/R2015a/matlab/ref/fft.html *|fft|*> (link).

8 years ago | 0

Answered
Vector and Matrices comparison
Use the <https://www.mathworks.com/help/stats/pdist2.html *|pdist2|*> (link) function. *_Example_ —* D = pdist2(V', N...

8 years ago | 1

| accepted

Answered
Which version should I upgrade to?
Version *|7.4.0.287|* is *|2007a|*. If you are concerned about graphics compatibility, *|R2014a|* would be the limit, becau...

8 years ago | 0

Answered
How do I fill arrays with a for loop?
I would test the current value of *|‘z’|* in your *|if|* blocks: z(a-1) > 1 and: z(a-1) < 1 respectively. ...

8 years ago | 1

Answered
How to determine the most common (most occurring) number in column of a large data of more than 100,000 length of data
If you want to count a range of values, rather than exact values, one option is to use the <https://www.mathworks.com/help/matla...

8 years ago | 1

Answered
How can I type inverse sign in axis labels?
Try this: figure plot(rand(1,20), rand(1,20), 'p') xlabel('A^{-1}') % Usi...

8 years ago | 1

Answered
putting function values in meshgrid format
Your data may already be gridded. I would first plot it using *|stem3|*, for example: figure stem3(X, Y, Z) grid on...

8 years ago | 1

| accepted

Answered
Plotting circles horizontally through entire range of x values on a constant y value
I am not certain what you want. Try this: x = rand(10,1); y = ones(size(x))*0.5; figure plot(x, y, 'o') ...

8 years ago | 0

| accepted

Answered
How to convert time domain data to frequency domain?
<https://www.mathworks.com/help/releases/R2015a/matlab/ref/fft.html *|fft|*> (link)

8 years ago | 0

Answered
Re-representing an int list
If your list is a vector of integers from *|1|* to *|11591|*, with a length of *|11591|*, try this: List = 1:11591; N =...

8 years ago | 0

Load more