Answered
Struct array with differently sized fields as parameter data for Simulink simulation
Hi Friedrich, Using 2022a (so there might be some updates in this area if using a later version), the Matlab Fucntion block can...

1 year ago | 0

| accepted

Answered
Can you create an object in Simulink that can be referenced by multiple MATLAB Fcn blocks?
Hi Roop, If you want to use global data inside Matlab Function blocks, start from Use Global Data in MATLAB Function Blocks to ...

1 year ago | 0

Answered
Is there a way to log variables from a Matlab Function Block (in Simulink), that is not output?
Here's one option based on the idea of @Aquatris to specify the local variables that you want to log from the Matlab Function as...

1 year ago | 1

| accepted

Answered
how to import parameters (weights and bias) in simulink
Hi Ahmad, To bring fc1, fc2, fc3 and fc4 into the Malab function block as constant parameters, start from Configure MATLAB Fun...

1 year ago | 1

Answered
Using logicals in arrayfun
rng(100) tempA = rand(10,18); tempB = 1:10; u = arrayfun(@(x,y) x{1}(1:y), num2cell(tempA,2), tempB.', 'UniformOutput', fals...

1 year ago | 1

Question


How does Symbolic diff() Operate When the Order of Derivative is Symbolic?
Simple symbolic function syms n integer positive syms x real f(x) = x^n First, second, and sixth (just to check) derivatives...

1 year ago | 1 answer | 0

1

answer

Answered
How to continually clock in data during a simulation within Simulink
Hi Dan, It appears that the output of the Bit to Integer Conversion block is a scalar, which can be checked by going to Debug -...

1 year ago | 0

Answered
Why such a fuss with ndgrid and meshgrid issues?
Hi Kristoffer, The inputs to griddata that can be in either meshgrid or ndgrid format are the query points in Xq and Yq. I thin...

1 year ago | 1

Answered
How to add a time delay to a diagonal ss from a reside pole function?
Hi Joan, The problem appears to be with how bodeplot is unwrapping the phase. Here is the original code % Delay problem Ak =...

1 year ago | 0

| accepted

Answered
how to label the variance decomposition table
Check the doc page collintest and review how to use the VarNames input. Or, instead of pulling all the variables out from data,...

1 year ago | 1

| accepted

Answered
PID controller, difference when graphing step function with PID control block in matlab and simulink
Hi hoang, The posted code doesn't result in the same figure as in the question s =tf('s'); g = 1.883e5/(s*(s^2+4466*s+6.43e6)...

1 year ago | 1

Answered
how to calculate singular values in collin test to detect multicollinearity
Hi NAFISA, Using the example from the the doc collintest load Data_Canada Output from collintest [sValues,condInx] = collint...

1 year ago | 1

Answered
FFT multiple input waves and plot on same graph
%% Input Signal fs = 20e3; numFilts = 32; % filter_number = numFilts; freq1 = 1000; % Hz Nperiods = 15; % we need more th...

1 year ago | 0

| accepted

Answered
How does nufft function work in matlab?
To get fft and nufft to yield the same results .... tmax = 12; n = 2^11; tau = 1; % Width of the gaussian pulse ...

1 year ago | 0

Answered
Temporarily Change Signal Line Names in Simulink
Hi Dhruv, At the risk of asking an obvious question, does the workflow require that the model be saved after modifying the gene...

1 year ago | 0

Answered
Why do these methods to obtain the simulink model transfer functions return different results?
Hi BW, Define PI and F s = zpk('s'); PI = 1 + 2/s; F = 6; In the first case, the linerarizer computes the transfer functio...

1 year ago | 1

| accepted

Answered
Simulink 3D matrix interpolation using pre-lookups
Hi Alborz, It looks like you're switching between 6x5 and 5x6 in your post. Assumign that a) the table is 6 x 5 x 2 as in the ...

1 year ago | 0

| accepted

Answered
Are there any alternatives to try/catch statements that are supported by code generation?
Hi Roop, Can you post the code of a simple Matab Function that illustrates how you're tyring to use a try/catch? I'm having tro...

1 year ago | 0

| accepted

Answered
Reconstruct time series from FFT components. There is a time shift error.
Hi Haifei, You may want to investigate why the data is not uniformly sampled and how that impacts the analysis. Does the other ...

1 year ago | 0

| accepted

Answered
Simulink - How to create a conditional "if" block
Perhaps you can use a Relay block to model the desired behavior based on the heating/cooling analogy. The output of the Relay ca...

1 year ago | 0

| accepted

Answered
Why do we use ifft instead of fft when looking at the spectrum of a sech pulse (uu) in this code?
Hi Siheon, Your interpretation of fft as going from time to frequency, and ifft as going from frequency to time, with fft and i...

1 year ago | 0

| accepted

Answered
Is enabled subsystem confusing? (Enable Port)
Hi Ahmed, To me that looks like an error in the documentation. That parameter controls what happens to the states inside the su...

1 year ago | 0

| accepted

Answered
Discrete convolution in time/Laplace domain
Simplest and most efficient approach would be to compute samples r_i = r(i*T) where T is the sampling period and then use conv t...

1 year ago | 1

| accepted

Answered
Is the "kinematicTrajectory" function correct for calculating angular velocity?
Hi Erik, The code is comparing two different quantities: Here, T is the matrix that mutliplies the angular velocity vector res...

1 year ago | 0

| accepted

Answered
Extracting Data from an Array of Arrays using a Loop?
Hi Kylen, To make sure I understand correctly .... at the end of the processing you have a variable called 'out' and it is an a...

1 year ago | 0

| accepted

Answered
How to use previous answer in new calculation n times
A=[0.3 -0.2; -0.6 0.8]; B=[-14;2]; x=[1;2]; sys = ss(A,B,eye(2),0,-1); y = lsim(sys,ones(11,1),0:10,x); % y0 = x %y...

1 year ago | 2

Answered
Frequency response of a system operating at a fixed frequency
Hi Alberto, Conceptually, what you're doing is correct (though there are other alternatives to the input signal). Keep in mind ...

1 year ago | 1

Answered
Designfilt and bandstopfir adds +320dB for some reason
Hi Andres, I don't have a complete answer, just an observation. Here's the original design with order 301 filterObject1 = des...

1 year ago | 0

| accepted

Answered
hey so i need to repeat the code everytime to see and analyze the time responses for 20 different values of k. How can i do it at once and have the output for all the values?
Or use a model array plant = tf(20,[1 1 5]); k = realp('k',1); sys = feedback(k*plant,1); sysarr = sampleBlock(sys,'k'...

1 year ago | 1

Answered
Even & Odd Discrete time Signals
Matlab doesn't support zero or negtaive indices, so it won't be possible to implement this operation using ordinary vector index...

1 year ago | 0

Load more