Answered
minutes to hour and minutes
Use the (:) subscript convention to forec the ‘mins’ argument to be a column vector: hr_min = @(mins) [fix(mins(:)/60) rem(min...

6 years ago | 0

Answered
Issues with loop- "Too many input arguments."
You are not calling it correctly! See if: fun= @(x) normpdf(x) [f]= NC_2(4,-3,0,fun) does what you want.

6 years ago | 0

| accepted

Answered
How do I plot an equation that requires I divide over a range?
There are (at least) two problems: First: r = 0.01:0.02; the default step for the colon,: operator is 1, so the range for...

6 years ago | 0

Answered
Plotting lissajous (phase figure) gives wrong results
Use a slightly different ode45 call, and then plot the columns of ‘y’ against each other: [t,y] = ode45(M,[0 100],[2 2]); f...

6 years ago | 0

| accepted

Answered
Plotting the tone frequencies
Note that ‘t’ seems to be missing. Substituting for it and changing the xlim parameters: t = values; figure ...

6 years ago | 0

| accepted

Answered
Enhancing an Audio file
Amplifying it is straightforward: [y,Fs] = audioread('Madam’s Comments on draft 3 of ppt (mp3cut.net)-2.mp3'); [yh,yl] = boun...

6 years ago | 0

| accepted

Answered
how to read data from file into a char array?
If you want to read the file as text, use the fileread function. You can then do what you want with it.

6 years ago | 0

Answered
Cannot plot a point in the color black
One line of code does not tell everything about what you are doing. I have no problem plotting in any of these colours. Try ...

6 years ago | 0

Answered
Why does the array only work once?
Use element-wise division: Phi = asind(AB*sind(Theta)./AD); ↑ ← HERE and: P = Mb./(BD*sind(90 - ...

6 years ago | 1

| accepted

Answered
Unable to find symbolic solution warning
It is nonllinear because of the ‘x*y’ terms, so it does not have an analytic solution that the Symbolic Math Toolbox can solve f...

6 years ago | 2

| accepted

Answered
Array indices must be positive integers or logical values
See the documentation sections on Anonymous Functions and also Array vs. Matrix Operations. You will need to understand those...

6 years ago | 0

Answered
I encounter error 'Array indices must be positive integers or logical values.' in a for loop
This is the problem: for n = 0:length(signal) since 0 is not a positive integer. Positive integers are integers greater than...

6 years ago | 0

Answered
How do I store data in a table from a for loop?
I do not follow everything you are doing, however if you simply want to save the ‘diameter’ result: diameter(i) = sqrt((area*4...

6 years ago | 0

| accepted

Answered
Undefined operator '<' for input arguments of type 'timeseries'.
It appears that you are using your own genetic algorithm code, rather than the ga function. The only problem is with the timese...

6 years ago | 0

| accepted

Answered
How to save everything in command window
See the diary function documentation.

6 years ago | 0

| accepted

Answered
Finding average slope without losing steep slopes
I have no idea whatt you actually want to do. One option is to simply do a linear regression on the entire data: ch_height = ...

6 years ago | 0

Answered
I need help with an error "Undefined function or variable 'x'"
The first line should be: syms n x that is, syms with a second ‘s’. (The sym call is to a valid function, however that synta...

6 years ago | 0

| accepted

Answered
How to label specific increments
Try this: x = linspace(0,2*pi,100); y1 = cos(x).^2; plot(x,y1,'--r') ylim([-1 1]) xticks(0:pi/100:2*pi) xticklabels({}); ...

6 years ago | 0

Answered
trigonometric equation with one unknown
In R2020b, using random initial estimates returns non-zero results: syms x y x=0.35; eq=cosh(x*y)*sin(y) - cos(x*y)*sinh(x*y...

6 years ago | 0

Answered
How to measure an angle of peaks in a plot?
That completely depends on how you define ‘angle’. This calculates the angle based on the peaks, and draws quiver arrows (‘an...

6 years ago | 0

| accepted

Answered
Plotting the Electric Field of a 3D Parallel Plate
To get the gradient over multiple dimensions, get multiple outputs from it. See specifically Contour Plot of Vector Field for a...

6 years ago | 1

| accepted

Answered
Correlation Coefficient in Legend
Change the legend call to: legend('Data', sprintf('Least square fit R = %.2f', R)) .

6 years ago | 0

Answered
Icon for legend not showing in graphs
This is a problem with certain AMD graphics drivers. Updating to the newest driver version solved it for me.

6 years ago | 0

| accepted

Answered
Mesgrid of time dependent coordinates
I am not certain what you want to do. Experiment with this: tt = linspace(-pi, pi, 50); x = 100*cos(tt); y = 100*sin(tt);...

6 years ago | 0

Answered
How to plot gradients ?
See Contour Plot of Vector Field.

6 years ago | 2

| accepted

Answered
Delete rows in a matrix to the largest power of 2.
One approach: M = randn(10,2); % Create Matrix if rem(log2(size(M,1)),1) ~= 0 row...

6 years ago | 0

| accepted

Answered
plotting multiple graphs and adding a straight line
There are at least 2 ways to do that: x1 = [0:1:101]; OA = 0.00022494*x1.^2; x2 = [0:1:74.4]; OF = -0.00018056*x2.^2; x3 =...

6 years ago | 0

| accepted

Answered
create a variable based on timetable's date period
Try this: DT = (datetime([2017 01 01]):caldays(1):datetime([2020 01 01])).'; % Create Dates HP =...

6 years ago | 0

| accepted

Answered
Solving Longitudinal Stability Differential Equations
Use the matrix exponential expm function, and use a for loop to iterate through the appropriate times. Use the linspace functio...

6 years ago | 0

Load more