Answered
pulling our elements from a matrix using for loop
Try this: B = A(1:6);

9 years ago | 0

| accepted

Answered
Sorting 2 Arrays for 2D Graphs
Probably the easiest way is to concatenate *|‘A’|* and *|‘B’|* into one array, then use the *|sortrows|* function: A = [.5...

9 years ago | 1

| accepted

Answered
Function of multiple outputs produces only one answer or three with a redundant 'ans' . How to fix?
Use a semicolon *|(;)|* at the end of each line to suppress the output to your Command Window: function [ampres,amplevels]...

9 years ago | 0

| accepted

Answered
HI I need to find gamma_t in this nonlinearal equation:
Try this: gamma_solve = @(gamma_t,gamma_0) ei(gamma_t./gamma_0)-(gamma_0/9.022); gamma=0:2:20; for k1 = 1:numel(gamm...

9 years ago | 0

| accepted

Answered
Count occurrences of an event by date
Try this: A = {'1/1/2001' 23 '1/1/2001' 29 '1/1/2001' 24 '3/1/2001' 22 '3/1/2001' 23}; ...

9 years ago | 1

| accepted

Answered
Please help me create simple function to convert celsius to fahrenheit and another for inverse?
Declare it as: function F = cel2fahr(C) That should work. See <http://www.mathworks.com/help/matlab/function-basics...

9 years ago | 0

| accepted

Answered
How can I detect shoulder peaks in a signal?
The gradient is definitely the way to go. If you have the Signal Processing Toolbox, use the <https://www.mathworks.com/help/si...

9 years ago | 1

| accepted

Answered
How can I plot a filled convex shape?
This works for me with both *|fill|* and *|patch|* in *|R2017b|*: x = [120 158 165 188 198 145]; y = [ 55 51 89 51 ...

9 years ago | 0

| accepted

Answered
Different axis increment plot
See the documentation on <https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.axes-properties.html *Axes Properties*>...

9 years ago | 0

Answered
Linewidth for function step?
Get the outputs of the *|step|* function, then plot them using a *|plot|* call: [y,t] = step(value_1); figure pl...

9 years ago | 2

| accepted

Answered
How to do exponential curve fitting like y=a*exp(b*x)+c
Try this: x=[10 12.5 15 17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50]; y=[62.1 77.3 92.5 104 112.9 121.9 125...

9 years ago | 5

| accepted

Answered
Plotting a Differential equation
You need to integrate it on *|[0 3]|* with *|‘f(t)=t’|* and *|‘h(0)=15’|*, then integrate it on *|[3 10]|* with *|‘f(t)=1’|*, an...

9 years ago | 0

Answered
How do I plot this?
It depends on the Toolbox you’re using. For a filter using the Signal Processing Toolbox, use the <https://www.mathworks.co...

9 years ago | 0

| accepted

Answered
determine the month when maximum and minimum monthly flow occurs.
Try this: TimeFlow = [10.0000 32.8393 11.0000 33.9103 12.0000 42.2562 1.0000 ...

9 years ago | 0

Answered
How to prevent my arrays from becoming multi-dimensional?
I cannot follow your code. However the multiple dimensions result from your using the colon *|(:)|* operator where you should b...

9 years ago | 0

| accepted

Answered
How can I create a new array from an original array, where the new array's elements appear for a number of times equal to the original's elements' value?
The *|repelem|* function will do what you want and without the loop. Using a simpler version of *|‘NN’|* to illustrate: ...

9 years ago | 1

| accepted

Answered
I want to plot F(x) and G(x) in same graph for x=(-10,10) how can I do this?
See the documentation on <http://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html *Anonymous Functions*> (link...

9 years ago | 0

Answered
How to round numbers in tables?
If you do not have the *|R2015a|* (I believe that is the correct release) that introduced the new *|round|* function, this anony...

9 years ago | 0

Answered
Derivative of legendreP function
The best way to compute the derivative of a *_vector_* (that I assume you are computing) is to use the <https://www.mathworks.co...

9 years ago | 0

Answered
How to avoid loops
With respect to comparing the longitudes, the <https://www.mathworks.com/help/matlab/ref/ismembertol.html *|ismembertol|*> funct...

9 years ago | 0

Answered
Linear Regression with Y as your Dependent Variable
Do you actually need to fit a curve to your data? Consider using the <https://www.mathworks.com/help/matlab/ref/interp1.html *|...

9 years ago | 1

| accepted

Answered
How to calculate Cycles
If you have *|R2015|* or later, you can use the <https://www.mathworks.com/help/matlab/ref/repelem.html *|repelem|*> (link) func...

9 years ago | 0

| accepted

Answered
how to design bandpass filter with cut off wavelengths given.
This will work for a filter design: Ts = 0.16; % Sampling Interval (U...

9 years ago | 1

| accepted

Answered
How can I draw multiple vertical lines in math lab?
Try this: figure(1) plot([1:2:20; 1:2:20], [20*ones(1,10); ones(1,10)], '-r') Change the color and line-type to crea...

9 years ago | 0

Answered
why is my error plot not showing?
The *|plot|* call needs to go _after_ the loop: figure(1); hold on; for i = 1:100 error(i) = abs(1-(exp(h(i)-...

9 years ago | 0

Answered
How to solve exponential equation in Matlab?
Use an anonymous function and the <https://www.mathworks.com/help/matlab/ref/fzero.html *|fzero|*> (link) function. See the...

9 years ago | 0

Answered
How to make contour3(x,y,z) plot from this experimental data
Your data are already gridded, so all you need to do is to use the *|reshape|* function to form them into matrices. If *|‘M...

9 years ago | 0

| accepted

Answered
how to build low-pass and high pass filter cubic B-spline matlab
Try this: Low_pass = [1/16 1/4 3/8 1/4 1/16]; figure(1) freqz(Low_pass, 1, 2^16) High_pass = fliplr(Low_pas...

9 years ago | 0

Answered
usinf fft shift i need only to display the positive part of the spectrum
Try this: fs=1e5; %Sampling Frequency t=0:1/(fs):0.001; %Time at which signal displays %First,generating a signal ...

9 years ago | 0

| accepted

Answered
How can I change the scale of Y axis with datetick and in 'MM:SS.FFF' ?
This will create the <https://www.mathworks.com/help/matlab/ref/duration.html *|duration|*> (link) array: td = (datenum([0...

9 years ago | 0

Load more