Answered
Insert comma/point in a number
I am not certain what you are doing. I _assume_ *|‘char’|* is a character vector. If so, this will work: char = '225...

9 years ago | 1

| accepted

Answered
I have designed a bandpass filter of order 20 and cutoff frequency of 3 - 15 Hz. I have seen the response from FVtool. In that filter coefficients section 1 numerator and denominator is given. What is that. How to use that coefficients
Use the numerator and denominator coefficients if you want to use the filter with the <https://www.mathworks.com/help/signal/ref...

9 years ago | 0

Answered
Projectile motion with drag:
As you have written your code, you need to subscript *_all_* your vectors: while i<n ax(i)=-(D/m)*v(i).*vx(i); a...

9 years ago | 0

| accepted

Answered
How do I optimize a function?
The optimisation routines need _vector_ input for the parameters. I combine them as vector *|‘p’|* here. Try this: x...

9 years ago | 0

| accepted

Answered
noise reduction by using filter
See <http://www.mathworks.com/help/signal/ug/remove-the-60-hz-hum-from-a-signal.html *Remove the 60 Hz Hum from a Signal*> (link...

9 years ago | 0

Answered
what is the equivalent function in 2014b for resample()?
I apologize for the confusion. I didn’t read your Question closely enough. The <https://www.mathworks.com/help/matlab/ref/...

9 years ago | 0

| accepted

Answered
maintain 0 at the start of a number
Try this: a = ('0123'); b = sprintf('%04u', uint64(str2num(a)))

9 years ago | 0

| accepted

Answered
Plot a complex sinusoidal function consisting of the sum of 5 sine waves
Start with: t = linspace(0, 2*pi); frq = [1 3 5 10 20]; then compute the sine of this matrix: arg = frq' * t; ...

9 years ago | 2

Answered
Solving 4th Order Differential Equations
You appear to be on the correct path. I would take your original symbolic differential equation as an argument to the Symbo...

9 years ago | 0

| accepted

Answered
How do you change the time step and decrease number of data points for a nonlinear data series?
I would use the Signal Processing Toolbox *|resample|* function. It will interpolate your signal to the new time vector, and in...

9 years ago | 0

Answered
Convert a single column in cell array to datetime format
I would create a *|table|* from *|‘data_temp’|*, then convert the first variable to a *|datetime|* array: data_temp = {"20...

9 years ago | 1

| accepted

Answered
uneven number of subplots in columns
Try this: x = rand(1, 10); A = 2*x; B = x.^2; C = B - A; figure(1) subplot(2,2,1) plot(A) title('...

9 years ago | 1

| accepted

Answered
Error using zp2tf ,Z must be a column vector. With searching ft
*_All_* the arguments have to be column vectors. Try this: z=[-3, -1]; p=[0 -6 -4 -2]; k=[4]; [num,den]=...

9 years ago | 0

Answered
How to improve my code for getting the output in the picture?
Try this: R=1.09677E+7; p=1; n=2; Z=1; for n= 2:9 n=n+1; k=R*Z^2*[1/(p^2)-1/(n^2)]; l...

9 years ago | 0

| accepted

Answered
Data within a spectogram
I am not certain what you want. Getting information from the *|spectrogram|* function is clearly explained in the documenta...

9 years ago | 0

Answered
Select a random number from each row of a matrix?
Try this: A=[1 2 3; 8 7 2; 5 8 1]; cidx = randi(3, size(A,1), 1); % Column Indices Out ...

9 years ago | 1

| accepted

Answered
How to make an array of alternating 1 and -1?
MATLAB indexing begins with *|1|*, not *|0|*, so you have to adjust your code slightly: xc = ones(1,12); for n=1:12 ...

9 years ago | 1

Answered
I would like to do the same thing as the following code but with only one line that gets drawn at different angles... Any ideas?
I am not certain what you want. Try this: n=100; x0=3; y0=4; x=linspace(0,20,n); y=[]; for i=1:n; ...

9 years ago | 1

| accepted

Answered
Switching the default settling time of STEPINFO
This works (in *|R2017b|*): S1 = stepinfo(sys,'SettlingTimeThreshold',0.05); st1 = S1.SettlingTime

9 years ago | 1

| accepted

Answered
Equation is correct but logically false???
This is one of the better discussions on the problem you are experiencing: <http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_...

9 years ago | 0

| accepted

Answered
Complex number on optimization
I did not even attempt to go through all your code. *_"If the loglikelihood is complex, then try again"_* Test to see ...

9 years ago | 0

Answered
plotting issue along the x-axis !
Use *|fliplr|* (or *|flip|*) on the *|x|* argument in the second *|plot|* call: x = linspace(0,10,20); y = x ; y1 = ...

9 years ago | 0

| accepted

Answered
I want to check whether a data at specific location in a cell type array in NaN or not in matlab
For cell arrays, you need to use *|cellfun|*: Score_NaN = cellfun(@isnan, Score);

9 years ago | 0

Answered
Getting number of variables whose sum is lower than certain number
Your *|for|* loop increments the counter until you exit it, so *|‘i’|* tracks the quantity of numbers you used to complete the l...

9 years ago | 0

| accepted

Answered
beginner code troubleshooting, matrix dimensions must agree
The problem is using *|‘T’|* as a subscript here: L(T) = (cl'*ld.^-5)/exp(c2'/ld*T')-1); Just do: L = (cl'*ld.^-5...

9 years ago | 0

| accepted

Answered
how to write transfer function without pole or zero value
The only way for you to do that is to use it in an anonymous function: abc = @(c) tf(1,[1 c]); then define *|‘c’|* and...

9 years ago | 0

| accepted

Answered
rewrite A=[3*1] matrix to [3*3]*[3*1(var)]=A
Doing it by matrix division (the *|mldivide|* function) did not work because the rows are not consistent. The only solution...

9 years ago | 0

| accepted

Answered
How to get final iteration when using for loops
Your code as written (adding an *|end|* that you omitted) will do what you want: x=randi(10,1,10); n=0; cumu=0; f...

9 years ago | 0

Answered
Why can't I use the plot function properly?
You most likely have a variable that you named *|‘plot’|*. Run this line: which plot -all If the first line in the...

9 years ago | 0

| accepted

Answered
Find the value of (p,beta) where f attains its maximum value. Here p is between (0,1) and beta is greater than zero
I have no idea what you are doing. Experiment with this: f = @(p,beta) d*log(p)+d*log(1-p)-beta*sum(y(1:d))-n*log(-lo...

9 years ago | 0

Load more