Answered
How should I write the fitness function for a function(fun1) with double summation
This seems straightforward (at least to me, unless there is more to this than is posted): fcn = @(x,M,N) M*(x(1)/(x(2)+5)-x(3)...

6 years ago | 1

| accepted

Answered
Create a sideways filled in bar plot
It would help to have an example of your data. That aside, the sort of plot you want to do is straightforward. Try this: ...

6 years ago | 0

Answered
Replace letter with dot
Try this: str = 'MOMENT AND INITIALIZATION'; newstr = str; old = {'M','I'}'; for k = 1:numel(old) newstr = strrep(ne...

6 years ago | 0

Answered
Strange behaviour of simplify
use the isAlways function to compare symbolic expressions: syms a b c t f1 = sqrt((a^2+b^2+c^2)/3) / t; f2 = sqrt(((a/t)^2+(...

6 years ago | 0

| accepted

Answered
How to locate slope changes, peaks, and valleys of transient data set
That small change at around 10000 is not a peak, it is instead a change in the slope. See if the ischange of findchangepts func...

6 years ago | 0

Answered
Plot as not expected
None of them are being ignored. The current y-axis limits are so large that the red line ‘C’ appears as a straight line. Use...

6 years ago | 0

| accepted

Answered
How to shade area under curve and x axis in log-log scale?
It is not possible to use patch directly on a logarithmic axis scale (at least I’ve never been able to get that to work), so the...

6 years ago | 1

Answered
Bessel filter transfer function
The besselap function creates a Bessel lowpass filter prototype. The besself function transforms the besselap design to create ...

6 years ago | 1

| accepted

Answered
how to reduce inverse laplace transforms
That is as simple as it gets. If you want decimal fractions, use the vpa function: syms s t F = 9787/(10*(s+177/2)) f = ...

6 years ago | 0

| accepted

Answered
How do i plot a discontinuous function?
Try this: f = @(x,y) ((x.^2)./(x.^2 - y.^2)) .* (abs(x) ~= abs(y)) [X,Y] = ndgrid(linspace(-1,1,150)); figure surf(X, ...

6 years ago | 1

| accepted

Answered
Why is my fundamental frequency at the 15th harmonic order
I am not certain what you are doing, or what result you want. One problem is that you also need to specify the x-values of th...

6 years ago | 0

| accepted

Answered
Error using symengine Unable to convert expression into double array.
Running: ReasonsDoubleIsNotPossible = symvar(subs(ltermi+h0termi+hntermi)) just before ‘error_dvd’ produces: ReasonsDoubleI...

6 years ago | 0

| accepted

Answered
Eval returns NaN when my number "r" gets too large
I am not certain what the problem is. To evaluate the ‘g’ function at the chosen value of ‘r’, try this: syms r g(r)=(12*...

6 years ago | 0

| accepted

Answered
How to label a stem plot??
Try this: Year = 1995:2020; Group = randi([2000 11000], size(Year)); figure stem(Year, Group, 'filled') lblc = sprintfc(...

6 years ago | 0

| accepted

Answered
Labels for bar plots
If I understand correctly what you are asking, see: How can I add the values to the top of the bars? for one approach.

6 years ago | 0

| accepted

Answered
optimization data fitting error
For the second ‘F’, as written, returns a row vector rather than a column vector. The solution is to use element-wise division:...

6 years ago | 0

| accepted

Answered
The legend box in plot has no colors
This is a known problem with recent AMD graphics drivers. See for example: Lines in legend are missing Updated drivers that...

6 years ago | 2

Answered
Determining symbolic function values without using matlabFunction
You are creating ‘jac_n’ inside the timing block in the code you posted, and creating a cell array from ‘x’. If you create th...

6 years ago | 0

| accepted

Answered
plotting a matrix in matlab
I have no idea what result you want. Try these: M = randi(99, 10); % Create Matrix [X,Y] = ndgrid(1:10); ...

6 years ago | 0

Answered
Combination of increasing and decreasing curve
I am not certain what result you want. Try this: theta = 0:10:180; Wnfcn = @(theta,const1,const2) ((theta <= 90) & (theta ...

6 years ago | 0

| accepted

Answered
Median frequency of a spectrogram
Using the spectrogram function may not be necessary, unless you need time-frequency analysis. To do all the frequencies to ge...

6 years ago | 1

| accepted

Answered
Plot line of best fit for semilog plot
It is not generally appropriate to transform possibly noisy data and then attempt to do a linear fit on it (polyfit does linear ...

6 years ago | 0

| accepted

Answered
Is there a way to read only two columns of a file with textscan?
There are 7 columns in the file image you posted. You can ignore a specific column by putting a * between the % and the descrip...

6 years ago | 0

| accepted

Answered
How do i create a function that switches the first and last row of a matrix?
Try this: M = [1 2 3; 4 5 6; 7 8 9] M([1 end],:) = M([end 1],:) producing: M = 1 2 3 4 5 6 ...

6 years ago | 0

Answered
Error Message "Input argument 't' might be unused" OR "Not enough Input Arguments"
Try this: odefun = @(t,v,M,G,K) [v(1); G-((K/M)*(v(2)^2))]; % Guessing That The ‘v^2’ Term Should Be ‘v(2)^2...

6 years ago | 1

Answered
Creating a 3D surface plot from array data
Try this: figure surf(Lucy) grid on or: figure mesh(Lucy) grid on The ‘x’ and ‘y’ axes are in units of the relevant in...

6 years ago | 0

| accepted

Answered
Import data from text file
That file is not easy to read, however it’s not impossible. It needs to be read in two stages. There might be easier ways to...

6 years ago | 0

| accepted

Answered
Positioning a cutted signal from a ECK Signal
You quoted part of my previous code (not entirely correctly) , so I’m ‘in for 1d, in for 1£ ', i guess. Try this: filename ...

6 years ago | 1

| accepted

Answered
findpeaks in a spectrum
The actual findpeaks output plot is not shown, and we do not have your data, so it is not possible to determine what findpeaks i...

6 years ago | 2

| accepted

Answered
Fitting parameters in ODE for a kinetic reaction
My parameter estimation code will only work for dynamic integrations with respect to time. If you want to estimate parameters...

6 years ago | 1

| accepted

Load more