How can I fix value of vector inside for loop ?
Your assignment is not quite clear but to the best understandinbg of mine. Note that repelem(A,1) if A is a scalar, the result i...

26 days ago | 1

| accepted

all ODE function returns NaN
There are two ways to address this issue. (1) Let ode15s to select appropriate step size; (2) make the step size much smaller th...

26 days ago | 0

Solving for Zeros Across a Range
There is an err in the loop in i = linspace(1,I) leads to non integer value that is NOT acceptable for an index. Here is a corre...

26 days ago | 0

How to save the scatter plot with and without transparency
Use exportgraphics() and also, note where the set() command for figure a and b is used and where exportgraphics() is used, e.g.:...

26 days ago | 0

Exported Regression Model is outputting NaN's when given new data.
There is one crtical point that is in the input data for the support vector machine regression model the input data needs to be ...

26 days ago | 0

| accepted

Recovering shape of periodically sampled signal in near resonance conditions
As understood your question correctly, is that you are trying to get the shape function which is the envelope thata can be compu...

1 month ago | 0

Recovering shape of periodically sampled signal in near resonance conditions
There are several fucntions of MATLAB which can be used in such exercises. They are interp1(), interp2, interpn,pchip, spline, g...

1 month ago | 0

Assign a row vector to a row of an array using logical indexing to omit certain values
As you stated that Q and G are zero matrices generated for memoty allocation if so, and you want to to fill out the values of Q ...

1 month ago | 0

Modeling using 6 differential equation and a constraint?
The problem is with this [ ] assigning step in your code: v = [ ]; What is the purpose of diving a number by an empty variable...

1 month ago | 0

how to use elements from array to sort data
Here is the corrected code: numdata=readmatrix("res Data.xlsx"); Q = numdata(1:5, :)'; F = numdata(6:10, :)';

1 month ago | 1

How to calculate 95% confidence interval using regression analysis?
If there is a linear fit model for x vs. y(x), then fitlm() can be used, e.g.: x = (0:.1:13)'; Noise = 35*randn(size(x)); y =...

1 month ago | 0

| accepted

Solving matrix differential equation
It looks likse sizes F1 and F2 are coherent with R1 and R2. The only question in your given exercise is R1' and R2' are transpo...

1 month ago | 0

Magitude from a three phase signal
Here is how to perform FFT and compute the phase angle values in rad: data = readmatrix('D_Sample.xlsx'); % Sample data im...

1 month ago | 0

Magitude from a three phase signal
Simulink -> Simscape toolbox, there is a block to compute magnitude and angle calculation: Calculate the magnitude and phase of...

1 month ago | 0

Grouping Categories in Scatter Plot
If understood your question correctly, here is one example how to address this issue: DATA = randi(100, 25, 1); BIN = discreti...

1 month ago | 0

What is the difference between "any" and "all" function?
There is one significant difference between any() and all(). Here are definitions: (1) any() - any True if any element of a ...

1 month ago | 1

why Code generations of 1D and 2D lookup are same ?
In case, you are using Simulink, use block 1D or 2D lookup table blocks: https://www.mathworks.com/help/simulink/lookup-table...

1 month ago | 0

| accepted

Generation of basic signals
In MATLAB and Simulink, there are few built in functions to generate, such signals as unit step, impulse, unit ramp, sine wave o...

1 month ago | 0

Matlab Transfer function multiple single s terms
Here it is: C1 = 0.000000000150; C2 = 0.000000000470; R1 = 10000; R2 = 180000; R3 = 2700; R4 = 56000; G = (R3+R4)/R3; ...

1 month ago | 0

| accepted

How to generate model output given a transfer function and input signal
use tfestimate() - here is documentation how to use it: https://www.mathworks.com/help/ident/ref/tfest.html#btkf8hm-2

1 month ago | 0

help with Plot a Parametric Equation
Here is a simple example code to get it done: N = 1e4; p = linspace(0,1); Na = linspace(1, 1e4); Nb = linspace(1, 6e3); Nc ...

1 month ago | 0

| accepted

How to find x,y coordinates.
(1) Using the data to be plotted y = @(t)2*t.^2+3*t-5; t = 0:2:8; f = y(t); tnew = 0:.2:8; y = interp1(t, f, tnew); figure...

1 month ago | 0

| accepted

change color of bar plot
Here is one example how to get such bar chart: y = [12 22 23; 21 25 26; 24 18 19; 22 17 15]; bar(y,'stacked') legend({'Set # ...

1 month ago | 1

timer doesn't work
Here is how it can be attained: Tspan = 240; % Time span 240 seconds t = timer('TimerFcn', 'stat=false; disp(''Timer!'')', 'S...

1 month ago | 0

How to get .m file definition programmatically?
It is possible differentiate .m and .mlx files by referring to their file extensions or simlarly, Simulink's .mdl and .slx or sl...

1 month ago | 0

timer doesn't work
Here it shows that it is working. An alternative way is to use [tic .. toc] to count time if this is the objective: Tspan = 10;...

1 month ago | 0

Removing numerical data from txt file
Here is the solution to keep the time of data collected in the external file: unzip('https://www.mathworks.com/matlabcentral/an...

1 month ago | 0

MATLAB is not deleting requested values.
Here is one example that shows it works: D = readmatrix('Data2.xlsx', 'Sheet', 1) % All imported D(1:2,:)=[] ...

1 month ago | 0

| accepted