Answered
How to save "optimoptions" to a file?
I have never tried that. I would save it to a .mat file. Then load it when you need it.

6 years ago | 2

| accepted

Answered
Jet Colormap with black and white at the ends
Try this: figure contourf(rand(20)) grid on colormap([0 0 0;jet(14);1 1 1]) % Append ‘White’ & ‘Black’ To ...

6 years ago | 0

Answered
Read only specific lines of a file and skip lines
See if the approach in How to skip lines of Data in a middle of a text file will do what you want. It will obviously be necessa...

6 years ago | 0

Answered
Writing data into a text file - fprintf
Note that just after ‘filename2’ is opened, it is immediately closed: fid = fopen(filename2, 'wt'); fclose(fid); That could ...

6 years ago | 2

| accepted

Answered
use sprintf while selecting exponential power
I wrote a utility function a while back to do just that: rfx = @(x,xpnt) [sign(x).*10.^(log10(abs(x))-xpnt), xpnt]; ...

6 years ago | 0

| accepted

Answered
Log Differentiation in MATlab
You can convert to by multiplying it by . So it would seem that the derivative would be: created by: syms x y(x) a ...

6 years ago | 0

| accepted

Answered
use the same function for multiple cells in a row.
These all work: dnv = datenum(now) + (0:10).'; % Numeric Array dt1 = datetime(dnv, 'ConvertFrom'...

6 years ago | 0

| accepted

Answered
Order Analysis - Retrieve "helidata"
Try this: load helidata It uses rpmfreqmap, introduced in R2015b, so if you have that or other functions it uses, you should ...

6 years ago | 0

Answered
Write arrays with exact values from .txt files with scientific notation
I suspect you have the format set at: format short Setting it to format long may be the solution,.

6 years ago | 0

| accepted

Answered
Fit curve when corresponding to one x value we have multiple y value?
If you want to regress all of them to the same set of parameters, this works: xm = repmat(x, size(y,1), 1); fcn = @(p,x) p(1)...

6 years ago | 1

Answered
How extracted envelop signal in matlab 2013
Use the hilbert function, specifically: DbEnv = abs(hilbert(Db)); Example — t = 0:0.01:5; ...

6 years ago | 0

| accepted

Answered
Plot not showing up
Try this: % Function for varying time t=(0:.5:7); for k = 1:numel(t) x(k) = (35 * cosd(65) * t(k)); y(k) = (35*sin...

6 years ago | 1

Answered
how to use sum in while loop
See if this does what you want: c = 1; t = 0; while t<4 a = 1/c; t = a+t; c = c+1; end Check = find(cumsu...

6 years ago | 1

Answered
Fitting data with ODE equation and multiple inputs
It turns out that your differential equation has an analytical solution: syms a b n x y(x) z y0 Eq = diff(y) == a*(1-y)^n * ...

6 years ago | 0

| accepted

Answered
Getting an error "Cannot call or index into a temporary array." (Code not written by me.)
If I understand the intent correctly, this should probably be: Depth7557 = linspace(7557,(7557+size(Grey7557,1)*0.0016402),siz...

6 years ago | 0

Answered
How to color the atomic position in 3D scatter plot
Try this: T1 = readtable('Fe3O4_1.txt'); x = T1.Var4; y = T1.Var5; z = T1.Var6; [AtomLbl,ID] = findgroups(T1.Var2); FeL...

6 years ago | 1

| accepted

Answered
How to split an array?
Use logical indexing‘: a=[1,4,6,9,13,17,20]; b1 = a(a<7) b2 = a(a>7) producing: b1 = 1 4 6 b2 = 9 ...

6 years ago | 0

| accepted

Answered
Curve Fitting and Distribution Fitting
Try this: yez = [ye, z]; Qf = @(c1,c2,c3,c4,c5,c6,c7,yez) ((c1-(c2.*(yez(:,1)+yez(:,2)))).*(asin(yez(:,1)).^c3)+c4.*((yez(:,1...

6 years ago | 0

| accepted

Answered
frequency to time domain
First, the phase must be in radians, and the highest frequency in both plots must be the Nyquist frequency for any inversion to ...

6 years ago | 1

| accepted

Answered
how to change the coefficient of system of ODE with respect to time ?
Interpolate from the Excel file, and choose a stiff solver: % Just some start parameters and coefficients Istart = 0.01; Ss...

6 years ago | 1

| accepted

Answered
Multiplying a polynomial with a vector.
Include all the operators, and use the vectorize function: y = str2func(['@(x)' vectorize('2*x^4+3*x-4')]) % Vectoriz...

6 years ago | 0

| accepted

Answered
Error using symengine and matrix must be square
MATLAB will not automatically parse ‘A’ into separate elements. It is necessary to use appropriate delimiters to separate the i...

6 years ago | 0

| accepted

Answered
I wanted to draw a cylinder and I tried using cylinder function but it didn't work because Subscript indices must either be real positive integers or logicals. Error in Untitled2 (line 5) z(1.05,:)=1.1; What can you recommend
Fractional subscripts are not defined in MATLAB. They must be ‘positive integers or logical values’. One option is to defin...

6 years ago | 0

| accepted

Answered
How to extract median frequency of EMG signal?
See if the Signal Processing Toolbox medfreq function (introduced in R2015a) will do what you want.

6 years ago | 0

Answered
Datestr() transforms the matrix of days
I cannot reproduce that. I get what the reults should be (in R2020a): day=[737433;737445;737457;737469;737481;737493;737505];...

6 years ago | 0

Answered
plot gaussian and standard deviation on my histogram
I would use normfit and normpdf, although there are also other options: image1 = 42*randn(1,1000)+42*3; ...

6 years ago | 0

| accepted

Answered
ParmHat not returning shape parameter
It returns both parameters for me (in R2020a, Update 5): data= [221447,277196,464274,565756,463453,564535,653655,564354,576124...

6 years ago | 0

| accepted

Answered
Editing existing figure properties
This has changed over time, specifically in R2014b. In R2020a, this works: Ax = findobj(hf, 'Type','Axes'); Lines = findob...

6 years ago | 0

Answered
how to create matrix from a row vector of different elements?
The first and second columns are consecutive elements of ‘A’ although with an offset for the second column. This is likely th...

6 years ago | 0

| accepted

Answered
How to change a variable to a time variable?
One approach: Ej = readtable('Ejemplo.xlsx'); Ej.StartTime = Ej{:,1} + days(Ej{:,2}); Ej.EndTime = Ej{:,1} + days(Ej{:,3}); ...

6 years ago | 0

| accepted

Load more