Main Content

Results for

Hi Everyone,
I have Experiemental Data (Bode Plot), using MATLAB I found the Transfer Function of my plant. I have attached my E7i_CSV file.
T2 = readtable('E7i_CSV.csv');
% Fill With Actual Sampling Frequency
FHz = T2.F;
Ts = 1/(2*(max(FHz)+10000))
for k = 1:size(T2,1)-1
if FHz(k+1) == FHz(k)
FHz(k+1) = FHz(k+1)+0.5; % 'Brute Force' Interpolation
end
end
Mag = T2.G;
PhDeg = T2.P;
Response = Mag.*exp(1j*deg2rad(PhDeg)); % Complex Vector
sysfr = idfrd(Response, FHz, Ts, 'FrequencyUnit','Hz')
%bode(sysfr)
%tfsys = tfest(sysfr,4,3) This is much better
tfsys = tfest(sysfr,4,3) %82.69%
%tfsys = tfest(sysfr,6,3)
figure
compare(sysfr, tfsys)
is_stable = isstable(tfsys);
disp(is_stable);
I want to convert this transfer function to statespace equations, which will be used for Model Predictive Control Design. Simple tf2ss command give me TF but it doesn't look very accrurate.
[A, B, C, D] = tf2ss(num,den)
So, I was reading a paper which i will follow, they have mentioned that they had FRF (Frequency Response Function) data and they find state space model/equations using Prediction Error Method (PEM). But I am unable to understand how I can used Bode Plot data and convert it state space using PEM. I will appreciate your help.
Secondy I verified the paper StateSpace Model by first converting it to Transfer Function and then using tf2ss command. which shows inaccurate results similiar to my results. I am looking for your help. Following is the verification code for paper i am following
%Rana Paper State Space Equations Coversion to
%Transfer Function for Validation Reason
% Define state-space matrices
Ax = [-49.3277, -980.7648, 618.2198;
567.3557, -120.2273, 651.7342;
-45.8885, -415.4194, -115.7522];
Bx = [-1.8122; 3.901370; 4.3011];
Cx = [14.9368, 16.9208, -23.6827];
Dx = 0;
% Create a state-space model
sys = ss(Ax, Bx, Cx, Dx);
% Display the state-space model
disp('State-Space Model:');
disp(sys);
% Convert the state-space model to a transfer function
tf_sys = tf(sys);
% Display the transfer function
disp('Transfer Function:');
disp(tf_sys);
%TF to StateSpace Rana Model
num_rana = [ -62.92 3.625*10^4 -1.065*10^8];
den_rana = [ 1 285.3 8.811*10^5 1.982*10^8];
tff_rana = tf(num_rana,den_rana);
tffss_rana = tf2ss(num_rana,den_rana);
[Arana,Brana,Crana,Drana] = tf2ss(num_rana,den_rana);
Shore
Shore
Last activity on 17 Oct 2023

Halloween Analysis of Many Aspects of Halloween Headquarters and Effects on USA
(Note to Chistopher: I used a simple ESP8266 generating random numbers for fields 1 thru 7, (0 to 100, 4000, 127, 30, 45, 200,000, 50,000) and 0 to 1 for field 8. And a couple of real sensor inputs.
goc3
goc3
Last activity on 23 Jan 2024

Have you ever learned that something you were doing manually in MATLAB was already possible using a built-in feature? Have you ever written a function only to later realize (or be told) that a built-in function already did what you needed?
Two such moments come to mind for me.
1. Did you realize that you can set conditional breakpoints? Neither did I, until someone showed me that feature. To do that, open or create a file in the editor, right click on a line number for any line that contains code, and select Set Conditional Breakpoint... This will bring up a dialog wherein you can type any logical condition for which execution should be paused. Before I learned about this, I would manually insert if-statements during debugging. Then, after fixing each bug, I would have to delete those statements. This built-in feature is so much better.
2. Have you ever needed to plot horizontal or vertical lines in a plot? For the longest time, I would manually code such lines. Then, I learned about xline() and yline(). Not only is less code required, these lines automatically span the entire axes while zooming, panning, or adjusting axis limits!
Share your own Aha! moments below. This will help everyone learn about MATLAB functionality that may not be obvious or front and center.
(Note: While File Exchange contains many great contributions, the intent of this thread is to focus on built-in MATLAB functionality.)
Nguyen Minh
Nguyen Minh
Last activity on 13 Oct 2023

I am an Automation Engineering student and I work extensively with algorithms using controllers. However, I am not very familiar with embedded systems. I noticed that there is a support package for STM32 boards in the Add-on tab.
Although I saw that it should support STM32WBxx, when I installed it, it appeared to be unavailable. Can anyone provide me with advice or a solution on how to implement my algorithms on this STM32WB55 board?
Thank you so much!
Hi
I am wokin on the transfer fuction block to model the dyamic syatem of the aircraft. But durin the modeling i have noticed that there is no sample time space to enter the value.
How can I enter the sample time in the discrete transfer fucntion block.
Moja
Moja
Last activity on 13 Oct 2023

The carot symbol on my keyboard (ˆ shift+6) doesn't work on matlab. Matlab doesn't recognize it so I can't write any equation with power symbol. I tried every possible solution on the web and it doesn't work. even in the character viewer I don't have any result when I search ''caret".
Exciting news for students! 🚀Simulink Student Challenge 2023 is live! Unleash your engineering skills and compete for exciting rewards. Submission deadline is December 12th, 2023!
Adam and Heather will be discussing new features in R2023b and answering your questions in a few hours - visit the link below to check out the preview and sign up for notification.
Adam Danz just launched a new blog about MATLAB Graphics and App Building.
As you know, He has been a prolific contributor to MATLAB Answers and one of his answers recently won the Editor's Choice Award.
If there are any topics or questions you are interested in, please share with Adam, and I am sure he will get those into his blog.
I want to design a continouos variable transmission that can be controlled using a PID controller. the one i have designed is giving errors. can anyone help?
Over the weekend I came across a pi approximation using durations of years and weeks (image below, Wolfram, eq. 89), accurate to 6 digits using the average Gregorian year (365.2425 days).
Here it is in MATLAB. I divided by 1 week at the end rather than multiplying by its reciprocal because you can’t divide a numeric by a duration in MATLAB (1/week).
weeks = @(n)n*days(7);
piApprox = ((years(13)-weeks(6))/years(13) + weeks(3)) / weeks(1)
% piApprox = 3.141593493469302
Here’s a breakdown
  • The first argument becomes 12.885 yrs / 13 yrs or 0.99115
  • Add three weeks: 0.99115 + 3 weeks = 21.991 days
  • The reduced fraction becomes 21.991 days / 7 days
Now it looks a lot closer to the more familiar approximation for pi 22/7 but with greater precision!
This person used computer version to build a keyboard input, and used standard flag semaphore for the positions.
Flag semaphore is used mostly by sailors to be able to communicate optically over a distance; it does not need anything more than make-shift flags (but binoculars or telescopes can help.) Trained users can go faster than you might guess.
Hans Scharler
Hans Scharler
Last activity on 8 May 2025 at 17:28

Chen, Rena, and I are at a community management event. It's great to be with others talking about relationships, trust, and co-creation.
I have toruble setting up back to back test for one of the reference Model in Autosar component.
Getting such error
An error occurred ('RTW:makertw:makeHookError') when calling 'sim':
The call to autosar_make_rtw_hook, during the entry hook generated the following error: Model 'BsdTrvlSigProc' references Interface Dictionary 'BsdInterfaces.sldd'. However, the AUTOSAR properties in the model are not properly linked to the Interface Dictionary. Delete and create a new AUTOSAR mapping for the model. The build process will terminate as a result.
Model 'BsdTrvlSigProc' references Interface Dictionary 'BsdInterfaces.sldd'. However, the AUTOSAR properties in the model are not properly linked to the Interface Dictionary. Delete and create a new AUTOSAR mapping for the model.
I tried deleting and creating new one. Since this reference model inside AUTOSAR component, I would expect configuration to be taken from top Interfaces.sldd
Please give me some hint.
Chen Lin
Chen Lin
Last activity on 16 Oct 2023

I'm in a community conference in Boston today and see what snacks we get! The organizer said it's a coincidence, but it's definitly a good idea to have them in our MathWorks community meetings.
Walter Roberson
Walter Roberson
Last activity on 8 May 2025 at 17:28

A research team found a way to trick a number of AI systems by injecting carefully placed nonsense -- for example being able able to beat DeepMind's Go game.
This video discusses the "Cody" bridge, which is a pedestrian bridge over a canal that has been designed to move up and out of the way when ships need to travel through. The mathematics of the bridge movement are discussed and diagrammed. It is unique and educational.
Walter Roberson
Walter Roberson
Last activity on 8 May 2025 at 17:28

Recently developed: a "microscope" based on touch and stereo vision.
Using touch removes the possibility of optical confusion -- for example, black on touch is only due to shape, not due to the possibility that the object has a black patch.
Sorry, you might need a Facebook account to watch the video.
Image Analyst
Image Analyst
Last activity on 16 Oct 2023

(Sorry - it should be 2023b by now.)