Answered
How do I restore MATLAB to original settings?
If you have R2018a or later, you might be able to do that using the information in the documentation section on Access and Modif...

7 years ago | 1

Answered
'Bandpass Butter filter' bode plot seems to not take into account the lower cutoff frequency
The bode function needs to know that you are plotting a discrete filter, because the filter coefficients are different than for ...

7 years ago | 0

| accepted

Answered
VAN DER PAUW equation
Convert your equation to an anonymous funciton, then use the fzero function: vdp = @(R) exp(-pi*100./R)+exp(-pi*79./R)-1; R...

7 years ago | 1

Answered
How can I make the range for the code below from 1 to 1000 to 0.1 to 5 ?!
First, you do not need the loop, since randi can produce everything you need in one call: Initial_POP = randi(1000, 50, 2); S...

7 years ago | 0

| accepted

Answered
Can anyone suggest how can I draw a tangent from a given point in line and get its intercept value on y axis?I
We do not have your data, however this illustrates the approach: x = linspace(-5, 5); % Create ...

7 years ago | 1

| accepted

Answered
Why do I get error for integral
Note that ‘f’ and ‘u_equ’ are vectors, not functions. So ‘fun’ is now: fun = @(x) (f-u_equ).*sin((n.*pi.*x)/len); %functio...

7 years ago | 0

| accepted

Answered
how can i read data given from a txt file and plot graph
If you have R2019a, use the readmatrix (link) function. You are supposed to use the contour function for the plot. EDIT ...

7 years ago | 0

Answered
Not enough input arguments
You have to call your function as: x = 42; y = fun(x); Simply using the ‘Run’ option by clicking the green arrow in the Edit...

7 years ago | 1

| accepted

Answered
create array of arrays from a single array
If ‘A’ is your matrix: A = [0.0001 85.0000 0.7105 -0.1184 0.0014 1.4070 0.0005 85.0000 0.7100 -0.118...

7 years ago | 0

Answered
Help With Starting Point for a Low Pass Filter
I am not certain what result you want. Here is a prototype lowpass filter design you can experiment with. It has a passband ...

7 years ago | 0

| accepted

Answered
How can I write a loop that vertically concatenates a series of sequentially named 1D arrays into a single 2D array
If you name them slightly differently from the outset, you can avoid the vertcat call entirely: a(1,:) = linspace(1,10,10); a...

7 years ago | 1

Answered
Error using odearguments (line 93) PHASE_1 must return a column vector.
You have the indices reversed. Try this: function dydt = Phase_1(t, y) dydt(1,1) = y(3); dydt(2,1) = y(4); dydt(3,1) = 2...

7 years ago | 0

| accepted

Answered
Why wont my code work with fplot?
The problem appears to be in your definition of ‘b’ that in your current code is 20.3, causing ‘A’ to rapidly increase to the fl...

7 years ago | 1

| accepted

Answered
Too many output arguments
The alpha (link) function sets the face transparency for graphics objects. It has no outputs. The solution is to rename your...

7 years ago | 0

Answered
Filtering column data with the same value
Try this: [Ud,~,ix] = unique(data(:,1)); maxVals = accumarray(ix, data(:,2), [], @max); Result = [Ud, maxVals] producing (f...

7 years ago | 0

| accepted

Answered
Correct Data Points Incorrect Plotting
The plot is correct. Note the at the upper end of the y-axis. Your y-values go from -999903 to 999897, or from about to .

7 years ago | 0

Answered
how can i find convex and concave points
It depends on how you want to define them. Here, I define them as points where the slope is -0.5: f = @(x) 1-(x./sqrt(1+x.^...

7 years ago | 1

| accepted

Answered
How can I fill area above a plot?
Try this: x = 0:10:90; % Create Data G1 = [-1 -2 -3 -4 -5 -7 -9 -11 -12 -1...

7 years ago | 3

| accepted

Answered
How to solve a set of matrix differential equations given below in Matlab?
Try this: y0 = [ 10 2 -5; 2 -10 0; -5 0 -30 ]; C = 0.5; f = @(t) [sin(t) 0 0 ; 0 1 0...

7 years ago | 1

| accepted

Answered
Refraining part of the function on the graph, while keeping the interval
Try this: y1 = @(x) -x-95.07; y2 = @(x) 10/7*x+18.67; xint = fzero(@(x)y1(x)-y2(x), 1); % Intersectio...

7 years ago | 0

| accepted

Answered
How can I transform two values separted by _ of one colum in two columns?
This seems to work: D = load('F.mat'); F = D.F; for k = 1:size(F,1) d(k,:) = sscanf(F{k},'%f_%f'); end The loop is ne...

7 years ago | 0

Answered
Solving differential equation with imaginary unit
The plot functions onnly plot real values. If you ask for the imaginary parts, you will see the results: fplot(imag(AfSol)) ...

7 years ago | 0

| accepted

Answered
For Loop with matrices?
One approach: A=[1 3;4 5]; x(:,1)=[1;2]; N = 10; for k = 1:N x(:,k+1) = A*x(:,k); end You simply need to be careful ...

7 years ago | 1

| accepted

Answered
finding intersection points by plot
If you are doing a linear regression, try this: p = polyfit(x,y,1); YAxisIntercept = p(2) XAxisIntercept = -p(2)/p(1) This ...

7 years ago | 0

Answered
fplot doesnt give the same result of plot
In your fplot loop, you may not be using your ‘polyFunc’ function correctly. It will work best with ‘x’ as the argument, not ‘p...

7 years ago | 0

Answered
how to play fsolve using for loop
Youi need to pass ‘a’ as a parameter to your ‘bicycle’ function. Try this: function F = bicycle(x,a) l2=2.1; l1=2.5; r=0.7...

7 years ago | 1

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
You need to subscript ‘x’ so that it only refers to one element of ’x’ in each loop iteration: x=0:1:5 for i=1:numel(x) ...

7 years ago | 0

Answered
Convert scalar values into date time and viceversa
One approach: D = datetime('now'); Future = D + days(1000) producing: Future = datetime 05-Feb-2022 09:13:39 ...

7 years ago | 0

Answered
matlab code for this eq
Try this: x = @(t,tp,r,K,A,f0) A.*cos(2*pi*f0.*(t.^2/2)).*(abs(r)<=(tp/2)); t = linspace(-10, 10); tp = 2; r = 3; K = 4;...

7 years ago | 0

| accepted

Load more