Answered
plz i need help to make this , thank u
If you want to find the column of ‘A’ or ‘B’ that has the minimum value in their respective matrices, this works: [~,cA] = fin...

7 years ago | 0

Answered
How to apply fft and band pass filter with raw data
Use the bandpass (link) function if you have R2018a or later. Otherwise, use an elliptical filter. These are straightforward t...

7 years ago | 0

| accepted

Answered
How do I plot my function that I made? It's piecewise.
I generally use Anonymous Functions (link) for these problems: y = @(t) -9*(t < 0) + (-9*cos(3*t)).*((0 <= t) & (t < 10)) + (-...

7 years ago | 0

Answered
sin(x)^2
Use the rewrite function: syms x ys = sin(x)^2; ye = rewrite(ys, 'exp') yc = rewrite(expand(ye), 'cos') p[roducing: yc ...

7 years ago | 5

| accepted

Answered
How to plot a 3D surface from scatter data inside a loop?
Your data are gridded, however you need to use the reshape function to create matrices from them. I changed your code slightly ...

7 years ago | 1

| accepted

Answered
solve function of ode45
There is an error in the code you posted. I believe it should be: dzdt(2,:)=-(c*z(1) - F + k*z(2))/(M + m); Otherwise, this ...

7 years ago | 0

Answered
Plotting multiple inputs on a single figure
Use the bsxfun function to add an offset value to each row of a matrix of signals. Example — t = linspace(0, 36, 250); ...

7 years ago | 0

| accepted

Answered
Why is the output of my function infinity?
The cosecant is , so at integral multiples of (such as , , ...) the cosecant will approach .

7 years ago | 0

Answered
Remove repeated numbers in series
Try this: x = [3 3 3 3 3 2 2 2 2 2 2 2 1 1 1 1 3 3 3 3 3 3]; dx = diff([0 x]); fx = find(dx ~= 0); Result = x(fx) producin...

7 years ago | 0

Answered
left and right sides have a different number of elements
My guess is that ‘A’, ‘B’ and ‘C’ are vectors, or you would not be subscripting them. You need to subscript them here as well...

7 years ago | 0

| accepted

Answered
Fractions inside a legend
To put a negative sign in front of it, do this: hl = legend('External Force','Net Force', '$F = -\frac{1}{3}$'); set(hl ,'Int...

7 years ago | 1

Answered
Do you know what to throw the real min command?
I do! real min char(ans) ans = 109 105 110 ans = 'min' It’s the ASCII code for the letters in ‘min’. ...

7 years ago | 2

Answered
how to find the row index of specific vector in a matrix
Try this: A = [2 0;-2 1;2 3]; RowIdx = find(ismember(A, [-2 1],'rows')) producing: RowIdx = 2

7 years ago | 6

| accepted

Answered
ode45 3D-Plot
In our universe, there are three large dimensions (although string theory posits 11 in all). That means that you can only plot ...

7 years ago | 1

| accepted

Answered
Matrix with values dependent on row and column.
One approach: [rm,cm] = ndgrid(1:10); rv = rm(:); cv = cm(:); el = rv + cv; R = reshape(el, 10, 10) ...

7 years ago | 0

| accepted

Answered
Max and Min Slopes
One approach: x0=0; x1=5; g0=0; g1=0; y0= 0; y1= 150; A1 = [x0^3,x0^2,x0,1; 3*x0^2,2*x0,1,0; x1^3,x1^2,x1,1; ...

7 years ago | 0

| accepted

Answered
I need to classify my result in catagories
Try this: ma=[-35.2644,0,0,-45.0000,-45.0000,0,35.2644,54.7356,30.0000,45.0000,0,-45.0000,30.0000,-54.7356,-54.7356,-54.7356,-...

7 years ago | 0

| accepted

Answered
Need to test all permutations
One approach is to use the ndgrid (link) function: A = [1 2 3]; B = [1 2]; C = [4]; [p1,p2,p3] = ndgrid(A,B,C); P = [p3(...

7 years ago | 0

| accepted

Answered
subscript indices must either be real positive integers or logicals help line u1(0)=2
Positive integers are integers greater than 0. This works: h = 0.5; N = 10; u1(1)= 2 ; u2(1)= 3 ; t(1) = 2; for n=1:10...

7 years ago | 0

| accepted

Answered
how to add legend values automatically ?
Try this (considerably simplified version of your code): t=linspace(0,7*pi,300); i= [ 2 3 4 5 ]; plot(t,cos(pi*0.1*i(:)*t));...

7 years ago | 1

| accepted

Answered
Second Order Ordinary Differential Equation Array
I’m not certain what you’re asking. If you want different results for different values of ‘D’, the easiest way is to add ‘D’ ...

7 years ago | 0

| accepted

Answered
Modify the Laplace variable in a transfer function
You need to involve the Symbolic Math Toolbox for this. syms s sv = 1/(s^2 + 0.2059); Oc = 1.07; N = 8; lp_poles = poly2...

7 years ago | 0

| accepted

Answered
Error bar in a scattered plot!
Try this instead: errorbar(y, errFo*ones(size(y)), 'o') Experiment to get the result you want.

7 years ago | 1

Answered
Write column in .txt file
You have several options. One approach: fid = fopen('YourFile.txt,'wt'); fprintf(fid,'%.6f\n',A) fclose(fid); Experiment...

7 years ago | 1

| accepted

Answered
Finding the peak value of a function
You have the correct idea, however it’s because ‘peakhalf’ may not corresond exactly to any elements of ‘f’. You have to incl...

7 years ago | 1

Answered
how to find peaks value using specific time interval instead of indices ?
Try this: t = linspace(0, 30, 1000); % Time Vector y = sin(2*pi*t); ...

7 years ago | 0

| accepted

Answered
RANSAC - Control over sampled data points
Try using the lsqr (link) function. It’s intended for sparse matrices, however it gave a finite result when I tested it with yo...

7 years ago | 0

Answered
5x5 grid of black squares
I am not certain what you want. Try this: blksqrx = [0 1 1 0]; blksqry = [0 0 1 1]; figure hold all for k1 = 1:5 ...

7 years ago | 0

| accepted

Answered
Accessing one value in an array
I can’t follow your regexpi application, however getting the first letters of the words in your cell array is almost trivial: ...

7 years ago | 0

| accepted

Answered
Fourier transform and Bode Plot from .CSV file
It would have been easier if you had saved your data to a text file rather than to an Excel .csv file. Try this: [~,S] = xl...

7 years ago | 0

Load more