Answered
How do i plot the amplitude and phase function of a butterworth filter?
It is not at all obvious what you are asking. If you want to plot all filter Bode plots on the same axes, the freqz function ...

6 years ago | 0

Answered
Error using findpeaks Expected Y to be a vector.
The findpeaks function only operates on vectors, and ‘y’ is apparently a (Nx2) matrix. Try this: for k =1:size(y,2) [p...

6 years ago | 0

Answered
Phasor representation of complex numbers
Converting to phasor representation is definitely taking the long way round. If you must: r2p = @(x) [abs(x) rad2deg(angle(...

6 years ago | 3

| accepted

Answered
plotting a horizontal line at each data point
Try this: x = 1:10; % Create Data yh = rand(size(x))-2; ...

6 years ago | 2

| accepted

Answered
Finding the gradient of a slope
The gradient function second argument is the uniform spacing constant (in the documentation, ‘h’, assumed to be 1 by default if ...

6 years ago | 0

Answered
got Root( ) function as an answer to solve function
Use: solution = vpasolve(func,x); although it may be necessary to use: solution = solve(func,x); solution = vpa(solution);...

6 years ago | 0

| accepted

Answered
How to get a continuous line through two scatter plots
Another approach: Lr=(0:0.02:1.4); Kr=(1-0.14.*Lr.^2).*(0.3 + 0.7.*exp(-0.65*Lr.^6)); %SteelA Lr1=0; Lr2=0.7356; Kr1=0.01...

6 years ago | 0

| accepted

Answered
partfrac() function returning same expression that was given as input
The partfrac function needs more information, specifically the variable (not expression) that you want it to use. This (note ...

6 years ago | 0

| accepted

Answered
How to read zero crossing values from script?
They are stored in the ‘t_exact’ vector. Plot them as: figure plot(time, da3td, '-b') hold on plot(t_exact, zeros(size(t...

6 years ago | 1

Answered
How to plot shifting square pulse
It is difficult to understand your code. Here is a slightly simpler version: x = linspace(-5, 5, 1000); pulse = [0 ones(1,...

6 years ago | 2

| accepted

Answered
How can I show the max point on a plot ?
Depending on what you want to do, and if there is only one maximum: x = 0:10; y = -(x-5).^2; [ymax,idx] = max(y); ...

6 years ago | 1

Answered
Why i don not get the graph when i add A1(x) in the function f1=@(x,y) A1(x)+(1.33*pi*eta*y^3)/(1+1.33*pi*eta*y^3);
Do not use the for loop here. Let vectorisation work for you. Try this: eta=0.25; L=2.5; a=0.1; h=0.1; b=6; x=a:h:b; ...

6 years ago | 0

| accepted

Answered
Trying to create an array
Try this: sp = [ -0.0895 + 0.9901i -0.0895 - 0.9901i -0.2342 + 0.6119i -0.2342 - 0.6119i -0.2895 + 0.0000i]; ...

6 years ago | 1

| accepted

Answered
Plotting 3 lines with different x values in one single plot?
Use the hold function to plot them individually. Example — x1 = sort(rand(1,10)); y1 = rand(size(x1)); x2 = sort(rand(1,2...

6 years ago | 0

Answered
Best member in each generation?
See: How to save data from Genetic Algorithm in case MATLAB crashes? .

6 years ago | 0

Answered
Selecting particular data range from table/ columns
Try this: T1 = table(rand(100,1), randi(75,100,1)); % Original Table L = table2array(varfun(@(x)((x>=15...

6 years ago | 1

| accepted

Answered
ODE45 solver problem outcome
The ‘==’ are correct here. They are symbolic equations, not logical operations. Otherwise, I would agree. Also, your code...

6 years ago | 0

| accepted

Answered
Scatter: Vary the color along the axis x
Use the ‘x’ vector to determine the dot colours: scatter(x,y,sz,x,'filled','o'); They all appear to be completely uniform. ...

6 years ago | 0

| accepted

Answered
Zero-crossing of every column of a matrix
If you want the maximum and minimum amplitudes (and you have R2017b or later releases), use the islocalmax and islocalmin funcit...

6 years ago | 0

| accepted

Answered
Force Matlab to show whole answer
The simplify function needs to be told to continue working untill it cannot simplify further or it reaches the iteration limit. ...

6 years ago | 0

| accepted

Answered
generate function to yield two outputs but still one is produced
Call your function as: [m,v]=stat2(x); and both ‘m’ and ‘v’ will magically appear in your workspace. If you call it withou...

6 years ago | 0

| accepted

Answered
Generalized Forced Van Der Pol Oscillator Phase Plot
Try this: function [t,y] = VanderPol(idis, ivel, mu, A, omega) [t,y] = ode23(@vdp1,[0 20],[2; 0]); plot(t,y(:,1),'-o',t,y(:,...

6 years ago | 2

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements
Note that ‘k1’ does not appear to exist in your code, so ‘dc(2)’ and everything else using it would be empty. That will throw t...

6 years ago | 0

| accepted

Answered
How do i plot the line of best fit?
Try this: %Load experimental data load('PressureExperiments.mat', 'PData') % disp(PData) %Seperating data A = PData(5,:)...

6 years ago | 1

| accepted

Answered
finding frequency and domain of equation using ode45
Try this: vdp1 = @(t,u) [u(2); -u(1)-((u(1))^3)]; tspan = linspace(0, 60, 240); a=0.1:0.1:0.3; for k = 1:numel(a) [t...

6 years ago | 2

| accepted

Answered
plotting x,y,z
Use the plot function. .

6 years ago | 0

| accepted

Answered
How do I create a 6 by 5 matrix, B, that contains random numbers between 0 and 10?
It depends on what sort of numbers you want. See the documentation for the rand and randi functions.

6 years ago | 0

Answered
How to obtain each each maximum value from each signal set?
You have the Signal Processing Toolbox, so use the findpeaks function to get the peak amplitudes. It has a number of options so...

6 years ago | 0

| accepted

Answered
factoring a symbolic matrix
The expression appears in the denominator of all the elements of the matrix, so just multiply it: syms s w1 L Eq = [s/((s^2 ...

6 years ago | 0

| accepted

Answered
Defining and plotting a piecewise function
Another option: S = @(T) (ag*S*n*F0*((T/Tb) + (1/n*F0)*(1 - T/Tb))).*(T >= 0 & T < Tb) + (ag*S*n*F0).*(T >= Tb & T < Tc) + (ag...

6 years ago | 0

| accepted

Load more