Pull up a chair!
Discussions is your place to get to know your peers, tackle the bigger challenges together, and have fun along the way.
- Want to see the latest updates? Follow the Highlights!
- Looking for techniques improve your MATLAB or Simulink skills? Tips & Tricks has you covered!
- Sharing the perfect math joke, pun, or meme? Look no further than Fun!
- Think there's a channel we need? Tell us more in Ideas
Newest Discussions

Hello everyone,
I am trying simulate a gas turbine system for my course on modelling and optimization of energy system. I have come out with a design consisting of a compressor, air preheater, combustion chamber and gas turbine. When I try to do the modelling in Simulink, I couldnt find something similar to combustion chamber. Does anyone have any experience in doing this?
Orginal Design:

I have also amended it and come out with second design, where I change to combustion chamber to a heater and the exhaust air is recycled back to air compressor, making it a closed loop system. But I am also unable to find heater from the simulink library, the closest i can get is convective heat transfer. Can someone help on this too and if the closed loop system is feasible to model?
Design 2 :

Hi everyone,
for my thesis project I would need to get, every second of the simulation, real-time output data from a Simulink model, without using Simulink Real-Time, as it supports only Speedgoat Hardware. Is there a particular set of blocks for that purpose?
I have to provide that real-time data to hardware for an Hardware in the Loop Simulation so I will need to be able also to receive, as an input, data from the hardware to the Simulink model, again every second of the simulation, to close the loop of the simulation.
Thank you in advance for your support.
Hi! I am using matlab inbuilt plot option( without typing code) to plot the data. This joins the data points using straight line by default. What will be the easiest way to plot if I want curve to join the points instead?
Quick answer: Add set(hS,'Color',[0 0.4470 0.7410]) to code line 329
Explanation: Function corrplot uses functions plotmatrix and lsline. In lsline get(hh(k),'Color') is called in for cycle for each line and scatter object in axes. Inside the corrplot it is also called for all axes, which is slow. However, when you first set the color to any given value, internal optimization makes it much faster. I chose [0 0.4470 0.7410], because it is a default color for plotmatrix and corrplot and this setting doesn't change a behavior of corrplot.
Suggestion for a better solution: Add the line of code set(hS,'Color',[0 0.4470 0.7410]) to the function plotmatrix. This will make not only corrplot faster, but also any other possible combinations of plotmatrix and get functions called like this:
h = plotmatrix(A);
% set(h,'Color',[0 0.4470 0.7410])
for k = 1:length(h(:))
get(h(k),'Color');
end
I keep getting this error message when trying to run my code, I'm confident my wiring is correct and I do not know what this error means-
Library 'Servo' is not uploaded to the board. Clear the current Arduino object and recreate it to include the appropriate library. For a list of available libraries, type 'listArduinoLibraries'.
here is my code
a=arduino();
s1 = servo(a, 'D9', 'MinPulseDuration', 700*10^-6, 'MaxPulseDuration', 2300*10^-6);
writePosition(s1,0);
userResponse = "yes";
while userResponse == "yes"
chicken = input("Insert your resistor");
voltage = readVoltage(a, "A0");
if voltage < 1.67155
resistor = "47k";
writePosition(s1,0.25);
minR = 47000 * 0.95;
maxR = 47000 * 1.05;
elseif voltage < 3.53128
resistor = "10k";
writePosition(s1,0.5);
minR = 10000 * 0.95;
maxR = 10000 * 1.05;
elseif voltage < 4.69941
resistor = "1k";
writePosition(s1,0.75);
minR = 1000 * 0.95;
maxR = 1000 * 1.05;
else
resistor = "330";
writePosition(s1,1);
minR = 330 * 0.95;
maxR = 330 * 1.05;
end
resistance = voltageToResistance(voltage);
withinTolerance = (resistance >= minR && resistance <= maxR);
disp(resistor)
if withinTolerance == 1
writeDigitalPin(a, "D4", 1);
writeDigitalPin(a, "D5", 0);
%disp("green")
else
writeDigitalPin(a, "D4", 0);
writeDigitalPin(a, "D5", 1);
%disp("Red")
end
userResponse = input("Would you like to check another resistor? ","s");
writePosition(s1,0);
writeDigitalPin(a, "D4", 0);
writeDigitalPin(a, "D5", 0);
end
The MATLAB AI Chat Playground is now open to the whole community! Answer questions, write first draft MATLAB code, and generate examples of common functions with natural language.
The playground features a chat panel next to a lightweight MATLAB code editor. Use the chat panel to enter natural language prompts to return explanations and code. You can keep chatting with the AI to refine the results or make changes to the output.

Give it a try, provide feedback on the output, and check back often as we make improvements to the model and overall experience.
Looking for an opportunity to practice your AI skills on a real-world problem? Interested in AI for climage change? Sign up for the Kelp Wanted challenge, which tasks participants with developing an algorithm that can detect the presence of kelp forests from satellite images.
Participants of all skill levels from anywhere in the world are welcome to compete!
MathWorks provides the following resources for all participants:
Hello,
What is the difference between a moving angle and a normal angle?
Compute the Rotation about Y-axis over moving angle a = 30°
then
rotation about X-axis of angle β= 45°
What will the code like?
Thank you
Hello there, I have a Amesim Black box model in Simulink. On my desktop, it works well. Also i tried to run on other desktops. Most of them work well. But some of them gives following error: Error in 'Model' while executing C MEX S-function 'Model', (mdlInitializeConditions), at time 0.0. Caused by: in Simcenter Amesim mexfunction: 'Model', Simcenter Amesim fatal error Cannot initialize Simcenter Amesim Model. EXIT This is an urgent case for me. Could you please help me?
Thank you so much.
Write a matlab script that will print the odd numbers, 1 through 20, in reverse.
I cannot figure out how to do this correctly, please help.
Dear Community,
I am trying to perform PowerGUI Loadflow analysis for EV Charging station. The model converges but the load flow vaues on the DC bus is zero. Whether power_loadflow supports Mixed AC/DC load Flow.
Can someone help me by providing guidance on how to preform the same
Regards
Vara
i need circuti to model wound rotor synchronous machine damping circuit in matlab simulink , is there any one know how to do it

when I build the model I get the name mismatch error for two calibratable signals . The signals are in the data dictionary , and I use them in the model by pulling from the dd with the same name . can anyone point me out what possibly cause this error?
we have extracted a .xml file from solidworks to import in matlab, when we tried to import it shows that simscape multibody should be installed and when we tried to install it it shows the message attached below.
we are working on an educational license provided by our university, is it the issue?
It is crucial to understand that this expression could be used in problems related to engineering, physics, mathematics, or any other aspect of real life.
Typically, Matlab is used to solve PDE and ODE problems. Perhaps users calculated this term 0^0 incorrectly in the process.

>> % Reviewed by Bewar Yousif Ali
>> % How to fix this problem 0^0 in Matlab !?
>> % Mathematically, x^0=1 if x≠0 is equal 1 else undefined(NaN)
>> 0^0
ans =
1
>> f=@(x,y) x^y;
>> f(0,0)
ans =
1
>> v=[2 0 5 -1];
>> v.^0
ans =
1 1 1 1
What amazing animations can be created with no more than 2000 characters of MATLAB code? Check out our GALLERY from the MATLAB Flipbook Mini Hack contest.
Vote on your favorite animations before Dec. 3rd. We will give out MATLAB T-shirts to 10 lucky voters!


Tips: the more you vote, the higher your chance to win.