Answered
loop calculation and skipping the numbers
The indexing is incorrect. It leaves gaps. The gaps can be eliminated with a more efficient indexing approach. This fixes t...

5 years ago | 0

| accepted

Answered
syntax error for matrix
Typo: A = [3+2+1*s 1*s+2 -3; -s-2 2+1*s+2*s+4*s -2*s; -3 -2*s 3+(1/(2*s))+2s] ...

5 years ago | 1

Answered
i could not fix the error part !
The problems were that the ode23 call has to be: [t,x] = ode23(@diff2,[t0,tf],x0); so it refers to ‘diff2’ correctly as a fun...

5 years ago | 1

Answered
How to rearrange an equation in matlab to get the poles?
If the Control System Toolbox is available — %Values Vs = 1; Z0 = 50; R = 50; C = 1e-9; L = 0; s = tf('s'); %Where s = ...

5 years ago | 0

Answered
Question concerning the detection of Rate of change (positive only in this case)
First lowpass filter the signal to remove as much noise as possible. The sgolayfilt function is best for removing broadband noi...

5 years ago | 0

| accepted

Answered
Solving and plotting solution of 3rd order ODE using ODE45
If the Symbollic Math Toolbox is available, use the odeToVectorField function to create the appropriate array, then use matlabFu...

5 years ago | 0

Answered
Adding values to a matrix in for loop
Subscript ‘in’ here — values_change = values_change + in(i); and then subscript ‘values’ (the preallocation is optional, howe...

5 years ago | 1

| accepted

Answered
How to find baseline intensity in noisy mass spectra?
In the posted data, the baseline is not a constant, since there is a descending part at the left end (below about 150) before it...

5 years ago | 0

Answered
This is far past my understanding of matlab and want to understand how to code such a thing, thank you
I only see two spikes in the Fourier transformed data, one at 120 Hz and the other at 240 Hz. A FIR filter can elimiated both s...

5 years ago | 1

Answered
How to keep yticklabels intact after reversing the Y-axis
Just change the labels — x = linspace(0, 100); y = [20:20:80].'*exp(-(x-50).^2/75); figure plot(x, y) grid title('Ori...

5 years ago | 1

| accepted

Answered
Need plot for time rather than samples
If the time vector does not already exist, create it — Signal = sin(2*pi*(0:999)*0.01) + randn(1, 1000); % Create 'Signal' ...

5 years ago | 0

Answered
How to use coeffs to a minimum power
One approach — syms x eqn(1,:) = 5*x^2 + 2*x + 8; eqn(2,:) = 42*x^3 + 3*x^2 + 3; eqn for k = 1:numel(eqn) [cfs...

5 years ago | 0

| accepted

Answered
How to generate a signal using exponential forier series?
I have no idea what the Question actually is, however generating a Fourier series from disconnected lines is straightforward, if...

5 years ago | 0

| accepted

Answered
Nyquist and bode plots
It the System Identification Toolbox is available, start with the idfrd function and go from there. The documentation is relati...

5 years ago | 1

| accepted

Answered
Solving system with ode45
‘I need to get 10 lines for each variable.’ This implies that one (or more) parameters must be varied 10 times and then integ...

5 years ago | 1

| accepted

Answered
Not enough input arguments
Run this: which abs -all from a script or the Command Window, and post the results. I suspect there is another ‘abs’ functio...

5 years ago | 0

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
We will likely need to have the ‘acc_g’ matrix. (It can’t be a vector, since the reference to it in the first loop is to column...

5 years ago | 1

| accepted

Answered
fprintf with cell and double values within a for loop
The code needed some tweaks. iter_names = {'One', 'Two', 'Three', 'Four'}; one = {12, 3, 5, 5}; two = {1,2,3,1}; three = {...

5 years ago | 0

Answered
Using ODE45 with sine function
‘... is there any way to write ode and plot within the same file?’ See if this produces the desired result — [tv,Yv]=o...

5 years ago | 0

Answered
How and what is the time period of following function
The stepinfo function will give essentially all the relevant information — R = 1;%Given values C = 0.01; L = 0.01; RC = R*C...

5 years ago | 0

Answered
How to separate a vector into two different vectors?
Try this — age_vec =[ 21 18 57 52 20 22 23 21.50 38 31 30 29 58 53 21.75 86 55]; Lv = age_vec > 37.5; ...

5 years ago | 1

| accepted

Answered
How do I pass input parameters when running a script within another?
Create ‘Script_A’ as a function with those inputs and specify an output value array that it will return. See the documentatio...

5 years ago | 0

Answered
Subscribing into a timetable using only the time values
Try this — sz = [120 4]; %Dimensionen of the Table varTypes = {'string','string' 'string','double'}; %Types of Variables var...

5 years ago | 0

| accepted

Answered
How to get the equation inside that of root(function,z) equation ,i.e the function only
The vpa funciton usually works — syms z Zfcn = root(z^4 - (190266216202962831605969987684001433013625*z^3)/14293443086071928...

5 years ago | 0

| accepted

Answered
How can i Calculate this with matlab?
Using the Symbolic Math Toolbox — syms m alpha = 1; L = 1; t = 0.05; x = 42; ...

5 years ago | 0

| accepted

Answered
I can't integrate symbolic expression with abs(x), and using sign(real(x)) produces wrong results
My version of MATLAB cannot run images of code. Apparently the variables have numeric values or the plot would not exist, so ...

5 years ago | 0

Answered
Problem Explicitly Defining a Plot Area
The problem is the 'Position','TightInset' name-value pair. The 'Position' property value must be a four-element vector. The '...

5 years ago | 0

| accepted

Answered
How to get the message output shown in the command window
Depending on the routine that is producing that output, it might be possible to write it to a file instead of or in addition to ...

5 years ago | 0

| accepted

Answered
zero‐padding at the end of the signals
With this assignment: y(1,250)=0; the ‘y’ vector no longer has 220 elements, it now has 250. To illustrate, this does not ...

5 years ago | 0

Answered
Use logic to determine if array contains a specific date
Use the month function, then do the comparison — x = datetime(2021,12,13); y = datetime(2021,11,13); TFx = month(x) == 12 T...

5 years ago | 0

| accepted

Load more