Answered
How to obtain peaks in the y-axis above a reference line in matlab plot
If you have the Signal Processing Toolbox, use the <https://www.mathworks.com/help/signal/ref/findpeaks.html *|findpeaks|*> (lin...

8 years ago | 0

Answered
FFT plot how to plot frequency
I would create the frequency vector *|‘Fv’|* as: Ts = mean(diff(T)); % Sampling In...

8 years ago | 0

Answered
Plot system of ODE in 22 variables.
The spaces in the individual rows are most likely causing the problem, for example in: ...; (k1*x(2)*x(1)-r1*x(3))- 2*(k2*x...

8 years ago | 1

| accepted

Answered
Finding values of Lambert's W function for x>0
Solve this the same way you solved the Bessel function, this time without the loop. Think of it this way: You want to find:...

8 years ago | 1

Answered
Representation of Y axis grid
See the section on <https://www.mathworks.com/help/matlab/creating_plots/change-tick-marks-and-tick-labels-of-graph-1.html#d119e...

8 years ago | 0

| accepted

Answered
How can i reorder NxM matrix into a 1D array
Using the <https://www.mathworks.com/help/matlab/ref/reshape.html *|reshape|*> (link) function: b = reshape(a([3 2 1],:)',...

8 years ago | 1

| accepted

Answered
How can I integrate this function to give a symbolic expression?
It will not give you a symbolic expression because you are not using the Symbolic Math Toolbox to integrate it. (That would lik...

8 years ago | 1

| accepted

Answered
How to compare column A and B based on the column C condition?
Try this: A = [1 7 0; 4 2 1;8 2 1; 2 4 1; 9 4 0]; C3 = A(:,3) == 1; % Log...

8 years ago | 0

| accepted

Answered
I couldn't find what is wrong with this solution. Can you help me?
The *|fzero|* function will only find one root on each interval. You will need to use a loop and have *|fzero|* begin with a di...

8 years ago | 1

| accepted

Answered
reading the data from a csv file with headers
If you have *|R2013b|* or later, use the <https://www.mathworks.com/help/matlab/ref/readtable.html *|readtable|*> (link) functio...

8 years ago | 2

| accepted

Answered
How do I transform this Digital filter to analog
Easiest: [ns,ds] = cheby2(n,rs,wn,'bandpass','s'); Then use *|freqs|* instead of *|freqz|*.

8 years ago | 0

Answered
How do I fix: Index exceeds array bounds.
If you want to increment *|‘j’|* inside the *|‘l’|* loop, the easiuest way is to reverse the order of the *|for|* calls: ...

8 years ago | 1

Answered
Using syms, Matlab stops working
See: <https://www.mathworks.com/matlabcentral/answers/399991-syms-sym-and-mupad-functions-cause-matlab-to-freeze *"syms", "sym",...

8 years ago | 0

Answered
taking the sum and average of a matrix using for loops while excluding two elements?
One approach: x = [10 7 7 6 7 7 8 5 7 7]; newx = x(x~=10 & x~=5) theSum = sum(newx) avg = theSum/length(x) ...

8 years ago | 0

| accepted

Answered
Problem with Response function in a mass-spring-damper System
You forgot to include *|‘t’|*. When I provided it, the problem turned out to be solved by using element-wise multiplication in ...

8 years ago | 1

| accepted

Answered
How do I plot component curves for system of differential equations? I keep getting errors for this compartment model
You have to supply the same number of initial conditions to the ODE solver as you have variables in your ODE equation. Assuming...

8 years ago | 1

| accepted

Answered
what does the following expression do?
It first creates *|‘Arr’|* as an empty array, the creates *|‘Arr’|* as a structure with fields *|‘N’|* and *|‘R’|*, and assigns ...

8 years ago | 0

| accepted

Answered
Solve nonlinear equation with positive solution (fsolve)
I am not certain what the values of *|‘x’|* should be. Try these: fcn = @(x) [0.44*x(1) + 0.23*x(2) + 0.33*x(3) - 514...

8 years ago | 0

Answered
Fill in region between data points
Try this: figure plot(x, y, 'o') hold on patch([x(:,1)' fliplr(x(:,3)')], [y(:,1)' fliplr(y(:,3)')], 'b', 'FaceAlp...

8 years ago | 0

| accepted

Answered
Improve fit quality for a custom function with near-perfect starting values
I like genetic algorithms, because it is possible to set them to search the entire parameter space. They tend to ignore local m...

8 years ago | 0

| accepted

Answered
Hey I need some help! Is there any way to use ode45 with very small numbers?
The easiest way is likely to re-scale them (and the constants *|‘q’|* and *|‘m’|*). Multiply them by *|1E+6|* (or the scaling f...

8 years ago | 1

Answered
fminsearch not minimizing function
I usually use the genetic algorithm *|ga|* function for complicated problems such as your. I tweaked your *|‘error’|* funciton ...

8 years ago | 0

| accepted

Answered
Creating a scatter plot with three variables.
This uses the value of *|‘Z’|* to scale the colors: x = 1:20; y = 1:20; [X,Y] = ndgrid(x,y); ...

8 years ago | 0

| accepted

Answered
What is the easiest way to draw polygon given only vertices coordinates ?
One approach: vertices = randi(9, 10, 2); % Create Vertices Matrix [x(:) y(:)]...

8 years ago | 0

Answered
Assistance plotting radiation pattern
I’m not certain what result you want. One option is to interpolate your data: Ai = linspace(min(A), max(A), 360); ...

8 years ago | 0

| accepted

Answered
Non-linear solver
See if this does what you want: F=96485; T=298; R=8.314; % % % i=a*exp(-c*F*E/(R*T))+b*exp(-d*F*E/(R*T)); ...

8 years ago | 2

| accepted

Answered
Matlab: store input variables for arrayfun
First, rewrite the function to include the additional parameters: function [value_final] = myvalue(fd,fs,th) value_fina...

8 years ago | 0

| accepted

Answered
How do i retrieve a specific value from a 2D matrix?
One approach: earliercalculatedvalue = 5; Wantedvalue = B(A == earliercalculatedvalue) ...

8 years ago | 1

| accepted

Answered
How can I solve cdfs of the general extreme value distribution for x?
See if using the inverse function for the general extreme value distribution: <https://www.mathworks.com/help/stats/gevinv.html ...

8 years ago | 0

Answered
Solve multivariate equation using fsolve()
You are apparently starting with: f = @(x, a, b, c) Something; although I have no idea what *|‘Something’|* may be. ...

8 years ago | 0

Load more