Author: PuTI
How to fit a set of data where one of the fitting parameters decays exponentially?
There are five parameters in the fitting function, we can first fix one of the parameters according to a general knowledge. reviously, we fitted multiple datasets (e.g., time-resolved spectra at different pump powers) independently. Now, we need to perform a global fit where the cavity linewidth (Γ_cav) must decay exponentially across all datasets. Our model is a two-coupled oscillator modeal, where the resonance energy and linewidth of emitters and cavity, and their coupling strength are obtained parameters. Could you advise on the general strategy for setting initial values in this case?Perhaps, could we implement a loop. In each iteration for a new dataset, the intial guess for the cavity linewidth (Γ_cav) would be perdicated on the exponential decay function using the parameters estimated fromthe already fitted datasets?There are five parameters in the fitting function, we can first fix one of the parameters according to a general knowledge. reviously, we fitted multiple datasets (e.g., time-resolved spectra at different pump powers) independently. Now, we need to perform a global fit where the cavity linewidth (Γ_cav) must decay exponentially across all datasets. Our model is a two-coupled oscillator modeal, where the resonance energy and linewidth of emitters and cavity, and their coupling strength are obtained parameters. Could you advise on the general strategy for setting initial values in this case?Perhaps, could we implement a loop. In each iteration for a new dataset, the intial guess for the cavity linewidth (Γ_cav) would be perdicated on the exponential decay function using the parameters estimated fromthe already fitted datasets? There are five parameters in the fitting function, we can first fix one of the parameters according to a general knowledge. reviously, we fitted multiple datasets (e.g., time-resolved spectra at different pump powers) independently. Now, we need to perform a global fit where the cavity linewidth (Γ_cav) must decay exponentially across all datasets. Our model is a two-coupled oscillator modeal, where the resonance energy and linewidth of emitters and cavity, and their coupling strength are obtained parameters. Could you advise on the general strategy for setting initial values in this case?Perhaps, could we implement a loop. In each iteration for a new dataset, the intial guess for the cavity linewidth (Γ_cav) would be perdicated on the exponential decay function using the parameters estimated fromthe already fitted datasets? transferred MATLAB Answers — New Questions
How can you save a 1 by 3 array in each position of a 4D array?
I am working on an interpolation project where I have 4 variables, each representing a dimension of a 4D array. There are three seperate values that coincide with each coordinate of the 4 dimensional array. The only way I have been able to make this work so far is that I currently have 3 seperate 4D arrays, each with the same set of variables but with one of the 3 values stored at each coordinate. The issue is that this creates a lot of reduntanat data and significantly increases the file size, while also increasing the computational resource requirement by running the interpolation 3 seperate times. I would like to only have one 4D array, with each coordinate housing a 1×3 with all 3 data points needed. Is this possible? If so, what is the best approach? I have approached this using Cell arrays, but I still run into errors of trying to assign 1×3 in a 1×1 space or with trying to assign doubles in the cell array.I am working on an interpolation project where I have 4 variables, each representing a dimension of a 4D array. There are three seperate values that coincide with each coordinate of the 4 dimensional array. The only way I have been able to make this work so far is that I currently have 3 seperate 4D arrays, each with the same set of variables but with one of the 3 values stored at each coordinate. The issue is that this creates a lot of reduntanat data and significantly increases the file size, while also increasing the computational resource requirement by running the interpolation 3 seperate times. I would like to only have one 4D array, with each coordinate housing a 1×3 with all 3 data points needed. Is this possible? If so, what is the best approach? I have approached this using Cell arrays, but I still run into errors of trying to assign 1×3 in a 1×1 space or with trying to assign doubles in the cell array. I am working on an interpolation project where I have 4 variables, each representing a dimension of a 4D array. There are three seperate values that coincide with each coordinate of the 4 dimensional array. The only way I have been able to make this work so far is that I currently have 3 seperate 4D arrays, each with the same set of variables but with one of the 3 values stored at each coordinate. The issue is that this creates a lot of reduntanat data and significantly increases the file size, while also increasing the computational resource requirement by running the interpolation 3 seperate times. I would like to only have one 4D array, with each coordinate housing a 1×3 with all 3 data points needed. Is this possible? If so, what is the best approach? I have approached this using Cell arrays, but I still run into errors of trying to assign 1×3 in a 1×1 space or with trying to assign doubles in the cell array. array, cell array, matrices, double MATLAB Answers — New Questions
Simulink Piezoelectric generator with boost converter failed to converge
I’m building a piezoelectric generator with boost converter for my assignment and I’m trying to create a feedback loop by using the capacitor voltage to control the switch for boost converter. The model works fine when the switch is disconnected, or controlled using a pulse generator, but it stops working when I connect the switch to the capacitor voltage. Any idea how to fix this?
The fullwave rectifier and piezoelectric generator is mostly following the design from this example model. https://www.mathworks.com/help/sps/ug/piezo-bender-energy-harvester.htmlI’m building a piezoelectric generator with boost converter for my assignment and I’m trying to create a feedback loop by using the capacitor voltage to control the switch for boost converter. The model works fine when the switch is disconnected, or controlled using a pulse generator, but it stops working when I connect the switch to the capacitor voltage. Any idea how to fix this?
The fullwave rectifier and piezoelectric generator is mostly following the design from this example model. https://www.mathworks.com/help/sps/ug/piezo-bender-energy-harvester.html I’m building a piezoelectric generator with boost converter for my assignment and I’m trying to create a feedback loop by using the capacitor voltage to control the switch for boost converter. The model works fine when the switch is disconnected, or controlled using a pulse generator, but it stops working when I connect the switch to the capacitor voltage. Any idea how to fix this?
The fullwave rectifier and piezoelectric generator is mostly following the design from this example model. https://www.mathworks.com/help/sps/ug/piezo-bender-energy-harvester.html boost converter, piezoelectric generator, powered electronics MATLAB Answers — New Questions
I want to suppress: useCS = logical 1 in command window
This "spam" repeats over and over in the command window. I want to suppress this.
useCS =
logical
1
useCS =
logical
1This "spam" repeats over and over in the command window. I want to suppress this.
useCS =
logical
1
useCS =
logical
1 This "spam" repeats over and over in the command window. I want to suppress this.
useCS =
logical
1
useCS =
logical
1 command window, usecs, missing semicolon MATLAB Answers — New Questions
How can I get 3 outputs from the battery ?
Post Content Post Content battery, simulink, simulation, vehicle, power_electronics_control, battery_system_management MATLAB Answers — New Questions
I saw R2025b update2 on the download page , but can’t receive it in the software notification? Even when I manually check for it.
I saw R2025b update2 on the download page
but can’t receive it in the software notification
Is there anything wrong?I saw R2025b update2 on the download page
but can’t receive it in the software notification
Is there anything wrong? I saw R2025b update2 on the download page
but can’t receive it in the software notification
Is there anything wrong? update2 MATLAB Answers — New Questions
Friends, how to distribute the torque of four motors on VCU, is there any learning material for this?
Friends, how to distribute the torque of four motors on VCU, is there any learning material for this?Friends, how to distribute the torque of four motors on VCU, is there any learning material for this? Friends, how to distribute the torque of four motors on VCU, is there any learning material for this? four motor MATLAB Answers — New Questions
convolution integral with ode45
Hi guys, can someone help me solve this equation of motion using ode45 or any other way? I dont know how to approach the convolution integral. Thank you!Hi guys, can someone help me solve this equation of motion using ode45 or any other way? I dont know how to approach the convolution integral. Thank you! Hi guys, can someone help me solve this equation of motion using ode45 or any other way? I dont know how to approach the convolution integral. Thank you! convolution, ode45, sdof, damped eom MATLAB Answers — New Questions
How to find the real roots and index root?
syms x m y M %H R_c R_a p R
%—————————————————
%Initilization
%—————————————————
U=zeros(1,’sym’);
A=zeros(1,’sym’);
B=zeros(1,’sym’);
C=zeros(1,’sym’);
D=zeros(1,’sym’);
E=zeros(1,’sym’);
F=zeros(1,’sym’);
series(x)=sym(zeros(1,1));
%—————————————————
%Parameters
%—————————————————
l=0.5;
%M=0.5;
H=0.5;
R_c=0.5;
R_a=0.25;
p=0.8;
R=0.25
%—————————————————
%Initial condition
%—————————————————
U(1)=y
U(2)=0
for i=1:14
U(i+2)=m;
A(1)=0;
B(1)=0;
C(1)=0;
for j=1:i
A(1)=A(1)+U(j)*(i-j+1)*(i-j+2)*U(i-j+3);
B(1)=B(1)+j*U(j+1)*(i-j+1)*U(i-j+2);
C(1)=C(1)+U(j)*U(i-j+1);
end
variable_m=(1+4*R_c)*i*(i+1)*U(i+2)+l*A(1)+l*B(1)-R_a*C(1)-M*(1-p)*U(i)-H*U(i)-R*U(i);
variable=solve(variable_m,m);
U(i+2)=variable;
end
for k=1:6
series(x)=simplify(series(x)+U(k)*(power(x,k-1)));
end
series
e1=subs(series,x,1);
e2=e1-1
root=solve(e2,y)
var2 = vpa(root)
%%%%%%%%%%%%%%%%%%%%%%%%HOW TO FIND THE REAL ROOT %%%%%%%%%%%%%%%%%%%
series_M=subs(series, y,root(1))
Fin_efficiency=int(series_M,x,0,1)
var = vpa(Fin_efficiency)
M=0:5
row=0;
eta=zeros(length(M))
for i=1:length(M)
row=row+1
eta(row)=var(M(row))
end
plot(M,eta)
%—————————————————————————————–
the following error apper where the error remaining
Array indices must be positive integers or logical values.
Error in indexing (line 936)
R_tilde = builtin(‘subsref’,L_tilde,Idx);
But the indices are positivesyms x m y M %H R_c R_a p R
%—————————————————
%Initilization
%—————————————————
U=zeros(1,’sym’);
A=zeros(1,’sym’);
B=zeros(1,’sym’);
C=zeros(1,’sym’);
D=zeros(1,’sym’);
E=zeros(1,’sym’);
F=zeros(1,’sym’);
series(x)=sym(zeros(1,1));
%—————————————————
%Parameters
%—————————————————
l=0.5;
%M=0.5;
H=0.5;
R_c=0.5;
R_a=0.25;
p=0.8;
R=0.25
%—————————————————
%Initial condition
%—————————————————
U(1)=y
U(2)=0
for i=1:14
U(i+2)=m;
A(1)=0;
B(1)=0;
C(1)=0;
for j=1:i
A(1)=A(1)+U(j)*(i-j+1)*(i-j+2)*U(i-j+3);
B(1)=B(1)+j*U(j+1)*(i-j+1)*U(i-j+2);
C(1)=C(1)+U(j)*U(i-j+1);
end
variable_m=(1+4*R_c)*i*(i+1)*U(i+2)+l*A(1)+l*B(1)-R_a*C(1)-M*(1-p)*U(i)-H*U(i)-R*U(i);
variable=solve(variable_m,m);
U(i+2)=variable;
end
for k=1:6
series(x)=simplify(series(x)+U(k)*(power(x,k-1)));
end
series
e1=subs(series,x,1);
e2=e1-1
root=solve(e2,y)
var2 = vpa(root)
%%%%%%%%%%%%%%%%%%%%%%%%HOW TO FIND THE REAL ROOT %%%%%%%%%%%%%%%%%%%
series_M=subs(series, y,root(1))
Fin_efficiency=int(series_M,x,0,1)
var = vpa(Fin_efficiency)
M=0:5
row=0;
eta=zeros(length(M))
for i=1:length(M)
row=row+1
eta(row)=var(M(row))
end
plot(M,eta)
%—————————————————————————————–
the following error apper where the error remaining
Array indices must be positive integers or logical values.
Error in indexing (line 936)
R_tilde = builtin(‘subsref’,L_tilde,Idx);
But the indices are positive syms x m y M %H R_c R_a p R
%—————————————————
%Initilization
%—————————————————
U=zeros(1,’sym’);
A=zeros(1,’sym’);
B=zeros(1,’sym’);
C=zeros(1,’sym’);
D=zeros(1,’sym’);
E=zeros(1,’sym’);
F=zeros(1,’sym’);
series(x)=sym(zeros(1,1));
%—————————————————
%Parameters
%—————————————————
l=0.5;
%M=0.5;
H=0.5;
R_c=0.5;
R_a=0.25;
p=0.8;
R=0.25
%—————————————————
%Initial condition
%—————————————————
U(1)=y
U(2)=0
for i=1:14
U(i+2)=m;
A(1)=0;
B(1)=0;
C(1)=0;
for j=1:i
A(1)=A(1)+U(j)*(i-j+1)*(i-j+2)*U(i-j+3);
B(1)=B(1)+j*U(j+1)*(i-j+1)*U(i-j+2);
C(1)=C(1)+U(j)*U(i-j+1);
end
variable_m=(1+4*R_c)*i*(i+1)*U(i+2)+l*A(1)+l*B(1)-R_a*C(1)-M*(1-p)*U(i)-H*U(i)-R*U(i);
variable=solve(variable_m,m);
U(i+2)=variable;
end
for k=1:6
series(x)=simplify(series(x)+U(k)*(power(x,k-1)));
end
series
e1=subs(series,x,1);
e2=e1-1
root=solve(e2,y)
var2 = vpa(root)
%%%%%%%%%%%%%%%%%%%%%%%%HOW TO FIND THE REAL ROOT %%%%%%%%%%%%%%%%%%%
series_M=subs(series, y,root(1))
Fin_efficiency=int(series_M,x,0,1)
var = vpa(Fin_efficiency)
M=0:5
row=0;
eta=zeros(length(M))
for i=1:length(M)
row=row+1
eta(row)=var(M(row))
end
plot(M,eta)
%—————————————————————————————–
the following error apper where the error remaining
Array indices must be positive integers or logical values.
Error in indexing (line 936)
R_tilde = builtin(‘subsref’,L_tilde,Idx);
But the indices are positive root and index issue MATLAB Answers — New Questions
Delay balancing failed when generating HDL code
The problem module identified in the report is the low-pass filter module shown in Figure 1.Can anyone solve this?The problem module identified in the report is the low-pass filter module shown in Figure 1.Can anyone solve this? The problem module identified in the report is the low-pass filter module shown in Figure 1.Can anyone solve this? hdl, delay MATLAB Answers — New Questions
MATLAB 2025a and 2025b crashed
matlab2025a和2025b在程序运行过程中出现闪退,并弹出下面这个窗口。而后我在打开matlab的时候也是刚打开就闪退,出现下面这个窗口,应该怎么解决呀?电脑重启之后有时候正常,有时候也不行,得重启好几次才行。
Matlab 2025a and 2025b experienced crashes during program execution and a window like the following popped up. Then, when I opened Matlab, it crashed immediately upon opening, and a similar window appeared. How can this be resolved? After restarting the computer, sometimes it works normally, but other times it doesn’t. It requires multiple restarts to make it work.matlab2025a和2025b在程序运行过程中出现闪退,并弹出下面这个窗口。而后我在打开matlab的时候也是刚打开就闪退,出现下面这个窗口,应该怎么解决呀?电脑重启之后有时候正常,有时候也不行,得重启好几次才行。
Matlab 2025a and 2025b experienced crashes during program execution and a window like the following popped up. Then, when I opened Matlab, it crashed immediately upon opening, and a similar window appeared. How can this be resolved? After restarting the computer, sometimes it works normally, but other times it doesn’t. It requires multiple restarts to make it work. matlab2025a和2025b在程序运行过程中出现闪退,并弹出下面这个窗口。而后我在打开matlab的时候也是刚打开就闪退,出现下面这个窗口,应该怎么解决呀?电脑重启之后有时候正常,有时候也不行,得重启好几次才行。
Matlab 2025a and 2025b experienced crashes during program execution and a window like the following popped up. Then, when I opened Matlab, it crashed immediately upon opening, and a similar window appeared. How can this be resolved? After restarting the computer, sometimes it works normally, but other times it doesn’t. It requires multiple restarts to make it work. matlab 闪退 MATLAB Answers — New Questions
FPGA Data Capture in Custom Board
I have a custom cyclone v soc board. I’m trying to follow along with debug IP core using FPGA Data Capture. https://www.mathworks.com/help/hdlcoder/ug/debug-ip-core-using-fpga-data-capture.html . The FPGA Data Capture interface does not appear for me as shown in step 1.2 of HDL Workflow Advisor. How do I add this interface to my custom reference design. Will HDL Workflow Advisor automatically add the appropriate IP core to the qsys project based on what signals I want to log?
I think part of the problem is I don’t have any FDC block in my library:
As you can see I do have the HDL Verifier Support Package for Intel Boards installed but there is no FPGA Data Capture block. I can not find it when searching for it either. Does this block exist in some other package or is there something wrong with my install?I have a custom cyclone v soc board. I’m trying to follow along with debug IP core using FPGA Data Capture. https://www.mathworks.com/help/hdlcoder/ug/debug-ip-core-using-fpga-data-capture.html . The FPGA Data Capture interface does not appear for me as shown in step 1.2 of HDL Workflow Advisor. How do I add this interface to my custom reference design. Will HDL Workflow Advisor automatically add the appropriate IP core to the qsys project based on what signals I want to log?
I think part of the problem is I don’t have any FDC block in my library:
As you can see I do have the HDL Verifier Support Package for Intel Boards installed but there is no FPGA Data Capture block. I can not find it when searching for it either. Does this block exist in some other package or is there something wrong with my install? I have a custom cyclone v soc board. I’m trying to follow along with debug IP core using FPGA Data Capture. https://www.mathworks.com/help/hdlcoder/ug/debug-ip-core-using-fpga-data-capture.html . The FPGA Data Capture interface does not appear for me as shown in step 1.2 of HDL Workflow Advisor. How do I add this interface to my custom reference design. Will HDL Workflow Advisor automatically add the appropriate IP core to the qsys project based on what signals I want to log?
I think part of the problem is I don’t have any FDC block in my library:
As you can see I do have the HDL Verifier Support Package for Intel Boards installed but there is no FPGA Data Capture block. I can not find it when searching for it either. Does this block exist in some other package or is there something wrong with my install? hdl verifier MATLAB Answers — New Questions
How to use “getkey” correct ?
I am currently using "getkey" but it appears to include some falts. The worst one is that it stops matlab and goes to the matlab main window, however the maylab script still runs, but it is hard to use without seeing the figure of my apllication.
What alternative functions can be used instead of "getkey" ?
best regards
OleI am currently using "getkey" but it appears to include some falts. The worst one is that it stops matlab and goes to the matlab main window, however the maylab script still runs, but it is hard to use without seeing the figure of my apllication.
What alternative functions can be used instead of "getkey" ?
best regards
Ole I am currently using "getkey" but it appears to include some falts. The worst one is that it stops matlab and goes to the matlab main window, however the maylab script still runs, but it is hard to use without seeing the figure of my apllication.
What alternative functions can be used instead of "getkey" ?
best regards
Ole reading keyboard MATLAB Answers — New Questions
How to start a simulation in steady-state ?
Hi everyone,
I have a question regarding how to the start of a simulation in simulink with the steady state signal (voltage in my case) from t=0s.
I have done the power flow initialization as well the steady-state initial state with the help of powergui but I still have a oscillating voltage, power output from the synchronous machine.
Do you have any idea how to get read of this transient ? For instance I’d like to start my simulation at t=0s with the state of t=0.6s
Thanks in advance !
AntoineHi everyone,
I have a question regarding how to the start of a simulation in simulink with the steady state signal (voltage in my case) from t=0s.
I have done the power flow initialization as well the steady-state initial state with the help of powergui but I still have a oscillating voltage, power output from the synchronous machine.
Do you have any idea how to get read of this transient ? For instance I’d like to start my simulation at t=0s with the state of t=0.6s
Thanks in advance !
Antoine Hi everyone,
I have a question regarding how to the start of a simulation in simulink with the steady state signal (voltage in my case) from t=0s.
I have done the power flow initialization as well the steady-state initial state with the help of powergui but I still have a oscillating voltage, power output from the synchronous machine.
Do you have any idea how to get read of this transient ? For instance I’d like to start my simulation at t=0s with the state of t=0.6s
Thanks in advance !
Antoine initialization, steady-state MATLAB Answers — New Questions
Why is event PreUpdate and PostUpdate not triggered in ChartContainer?
Hi all,
I’ve created a ChartContainer in MATLAB R2024b and need to track when its update routine finishes so I can restore an internal property to its original value. During setup, I added listeners for the PreUpdate and PostUpdate events of the ChartContainer.
However, when I change a property, the update method runs, but neither the PreUpdate nor PostUpdate events seem to fire.
Below I share the class implementation:
classdef TestComponent < matlab.graphics.chartcontainer.ChartContainer
%% Properties
properties (AbortSet)
% Internal use. Indicates update is required, triggered by external
% property.
TriggerUpdate (1,1) logical = false;
end %properties
properties (Transient, NonCopyable, Hidden, SetAccess = protected, UsedInUpdate = false)
% Event listener array
EventListeners (1,:) event.listener
end
%% Protected Methods
methods (Access = protected)
function setup(obj)
% Setup routine
% Show setup routine is executed
disp(‘setup’)
% Setup listeners to all events in the class
metaClass = meta.class.fromName(class(obj));
eventList = {metaClass.EventList.Name};
listenAcces = {metaClass.EventList.ListenAccess};
% Initialize listener to post-update event
for idx = 1:numel(eventList)
if ~strcmpi(listenAcces{idx}, {‘public’, ‘protected’})
continue
end
obj.EventListeners(end+1) = listener(obj, …
eventList{idx}, @(s,e) obj.showEvent(e));
end
end %function
function update(obj)
% Update routine
% Show update routine is executed
disp(‘update’)
end %function
end %methods
methods
function showEvent(obj, e)
disp(e)
end %function
end %methods
end
Does anyone know why these events aren’t triggered? For ComponentContainer, the events work as expected.Hi all,
I’ve created a ChartContainer in MATLAB R2024b and need to track when its update routine finishes so I can restore an internal property to its original value. During setup, I added listeners for the PreUpdate and PostUpdate events of the ChartContainer.
However, when I change a property, the update method runs, but neither the PreUpdate nor PostUpdate events seem to fire.
Below I share the class implementation:
classdef TestComponent < matlab.graphics.chartcontainer.ChartContainer
%% Properties
properties (AbortSet)
% Internal use. Indicates update is required, triggered by external
% property.
TriggerUpdate (1,1) logical = false;
end %properties
properties (Transient, NonCopyable, Hidden, SetAccess = protected, UsedInUpdate = false)
% Event listener array
EventListeners (1,:) event.listener
end
%% Protected Methods
methods (Access = protected)
function setup(obj)
% Setup routine
% Show setup routine is executed
disp(‘setup’)
% Setup listeners to all events in the class
metaClass = meta.class.fromName(class(obj));
eventList = {metaClass.EventList.Name};
listenAcces = {metaClass.EventList.ListenAccess};
% Initialize listener to post-update event
for idx = 1:numel(eventList)
if ~strcmpi(listenAcces{idx}, {‘public’, ‘protected’})
continue
end
obj.EventListeners(end+1) = listener(obj, …
eventList{idx}, @(s,e) obj.showEvent(e));
end
end %function
function update(obj)
% Update routine
% Show update routine is executed
disp(‘update’)
end %function
end %methods
methods
function showEvent(obj, e)
disp(e)
end %function
end %methods
end
Does anyone know why these events aren’t triggered? For ComponentContainer, the events work as expected. Hi all,
I’ve created a ChartContainer in MATLAB R2024b and need to track when its update routine finishes so I can restore an internal property to its original value. During setup, I added listeners for the PreUpdate and PostUpdate events of the ChartContainer.
However, when I change a property, the update method runs, but neither the PreUpdate nor PostUpdate events seem to fire.
Below I share the class implementation:
classdef TestComponent < matlab.graphics.chartcontainer.ChartContainer
%% Properties
properties (AbortSet)
% Internal use. Indicates update is required, triggered by external
% property.
TriggerUpdate (1,1) logical = false;
end %properties
properties (Transient, NonCopyable, Hidden, SetAccess = protected, UsedInUpdate = false)
% Event listener array
EventListeners (1,:) event.listener
end
%% Protected Methods
methods (Access = protected)
function setup(obj)
% Setup routine
% Show setup routine is executed
disp(‘setup’)
% Setup listeners to all events in the class
metaClass = meta.class.fromName(class(obj));
eventList = {metaClass.EventList.Name};
listenAcces = {metaClass.EventList.ListenAccess};
% Initialize listener to post-update event
for idx = 1:numel(eventList)
if ~strcmpi(listenAcces{idx}, {‘public’, ‘protected’})
continue
end
obj.EventListeners(end+1) = listener(obj, …
eventList{idx}, @(s,e) obj.showEvent(e));
end
end %function
function update(obj)
% Update routine
% Show update routine is executed
disp(‘update’)
end %function
end %methods
methods
function showEvent(obj, e)
disp(e)
end %function
end %methods
end
Does anyone know why these events aren’t triggered? For ComponentContainer, the events work as expected. matlab, plot, chartcontainer, update, event MATLAB Answers — New Questions
Forrtl: severe (38): error during write, unit -1 file CONOUT$
I created the model in 2020. It was compiled and ran successfully. I was able to compile this model successfully with MATLAB 2024b and 2025a but error occured during runtime.I created the model in 2020. It was compiled and ran successfully. I was able to compile this model successfully with MATLAB 2024b and 2025a but error occured during runtime. I created the model in 2020. It was compiled and ran successfully. I was able to compile this model successfully with MATLAB 2024b and 2025a but error occured during runtime. traj MATLAB Answers — New Questions
How to control intermediate variables when Simulink generates C code, and how to control the index values and function names for 2D lookup tables.
Hello, I encountered some problems when using Simulink to generate C code. My model is shown in Figure 1, and the model optimization configuration is shown in Figure 2. I disabled signal storage reuse but disabled local output reuse; all other settings are default.
1、If I enable reusing local outputs, it will use a local variable multiple times, which makes the code less readable. Even if I disable reusing local module outputs, some local variables are still reused. I want to improve readability but don’t want each module to output individually. How can this be resolved?
2、How should I control the generation of intermediate variables? Do I need to name all module names and signal names? Is it possible to know in advance where intermediate variable names will be generated?
3、In Figure 3, the two-dimensional lookup table I used has the same dimensions, and when generating code it will generate a shared index value called ‘pooled.’ How should this variable be controlled?
4、Currently, the lookup functions I generate for the code are placed in model.c. Can the functions generated by the lookup module be placed in a specified file?
5、Is it possible to generate a structure to control the breakpoints and table data of the lookup module? I can do this using the Struct storage class in Simulink, but the lookup data ends up appearing in model.c, which makes my model.c look messy.
6、3. In Figure 4, there is matrix multiplication in the model. I have named the intermediate signal lines and the modules before and after, so why does it still generate a tmp variable? Is this variable used for the loop operation in matrix addition?
There are corresponding file attachments at the end.Hello, I encountered some problems when using Simulink to generate C code. My model is shown in Figure 1, and the model optimization configuration is shown in Figure 2. I disabled signal storage reuse but disabled local output reuse; all other settings are default.
1、If I enable reusing local outputs, it will use a local variable multiple times, which makes the code less readable. Even if I disable reusing local module outputs, some local variables are still reused. I want to improve readability but don’t want each module to output individually. How can this be resolved?
2、How should I control the generation of intermediate variables? Do I need to name all module names and signal names? Is it possible to know in advance where intermediate variable names will be generated?
3、In Figure 3, the two-dimensional lookup table I used has the same dimensions, and when generating code it will generate a shared index value called ‘pooled.’ How should this variable be controlled?
4、Currently, the lookup functions I generate for the code are placed in model.c. Can the functions generated by the lookup module be placed in a specified file?
5、Is it possible to generate a structure to control the breakpoints and table data of the lookup module? I can do this using the Struct storage class in Simulink, but the lookup data ends up appearing in model.c, which makes my model.c look messy.
6、3. In Figure 4, there is matrix multiplication in the model. I have named the intermediate signal lines and the modules before and after, so why does it still generate a tmp variable? Is this variable used for the loop operation in matrix addition?
There are corresponding file attachments at the end. Hello, I encountered some problems when using Simulink to generate C code. My model is shown in Figure 1, and the model optimization configuration is shown in Figure 2. I disabled signal storage reuse but disabled local output reuse; all other settings are default.
1、If I enable reusing local outputs, it will use a local variable multiple times, which makes the code less readable. Even if I disable reusing local module outputs, some local variables are still reused. I want to improve readability but don’t want each module to output individually. How can this be resolved?
2、How should I control the generation of intermediate variables? Do I need to name all module names and signal names? Is it possible to know in advance where intermediate variable names will be generated?
3、In Figure 3, the two-dimensional lookup table I used has the same dimensions, and when generating code it will generate a shared index value called ‘pooled.’ How should this variable be controlled?
4、Currently, the lookup functions I generate for the code are placed in model.c. Can the functions generated by the lookup module be placed in a specified file?
5、Is it possible to generate a structure to control the breakpoints and table data of the lookup module? I can do this using the Struct storage class in Simulink, but the lookup data ends up appearing in model.c, which makes my model.c look messy.
6、3. In Figure 4, there is matrix multiplication in the model. I have named the intermediate signal lines and the modules before and after, so why does it still generate a tmp variable? Is this variable used for the loop operation in matrix addition?
There are corresponding file attachments at the end. simulink, generate code, lookuptable, embedded coder MATLAB Answers — New Questions
how to add a constraint condition to fsolve?
Hi everyone,
These days I want to solve a system of nonlinear equations with matlab. In the equations, there are all four unkonwns, A(1),A(2),A(3)and A(4) to be solved but only three equations. therefore, the ‘levenberg-marquardt’ algorithm is applied to get the results. However, for physical meaning, an additional constraint is required, i.e. A(3)should be larger than zero. and with the ‘levenberg-marquardt’ algorithm, in the the obtained result, A(3) is negative.
Does anyone know how to add this constraint condition to fsolve ? Your help will be highly appreciated!Hi everyone,
These days I want to solve a system of nonlinear equations with matlab. In the equations, there are all four unkonwns, A(1),A(2),A(3)and A(4) to be solved but only three equations. therefore, the ‘levenberg-marquardt’ algorithm is applied to get the results. However, for physical meaning, an additional constraint is required, i.e. A(3)should be larger than zero. and with the ‘levenberg-marquardt’ algorithm, in the the obtained result, A(3) is negative.
Does anyone know how to add this constraint condition to fsolve ? Your help will be highly appreciated! Hi everyone,
These days I want to solve a system of nonlinear equations with matlab. In the equations, there are all four unkonwns, A(1),A(2),A(3)and A(4) to be solved but only three equations. therefore, the ‘levenberg-marquardt’ algorithm is applied to get the results. However, for physical meaning, an additional constraint is required, i.e. A(3)should be larger than zero. and with the ‘levenberg-marquardt’ algorithm, in the the obtained result, A(3) is negative.
Does anyone know how to add this constraint condition to fsolve ? Your help will be highly appreciated! fsolve MATLAB Answers — New Questions
Error: 403X-ERR#MHOD HELP
I’m a student and I’ve been trying to access Matlab online, and I’m getting an error saying, "Access Denied," which says: 403X-ERR#MHOD. It worked fine on May 7th, but it’s not working this afternoon. Is there a solution? I need it to review my university classes.I’m a student and I’ve been trying to access Matlab online, and I’m getting an error saying, "Access Denied," which says: 403X-ERR#MHOD. It worked fine on May 7th, but it’s not working this afternoon. Is there a solution? I need it to review my university classes. I’m a student and I’ve been trying to access Matlab online, and I’m getting an error saying, "Access Denied," which says: 403X-ERR#MHOD. It worked fine on May 7th, but it’s not working this afternoon. Is there a solution? I need it to review my university classes. access MATLAB Answers — New Questions
Can MATLAB be installed on two computers? Or, how often can a matlab license be transferred between two computers?
Can MATLAB be installed on two computers? Or, how often can a license be transferred between two computers?
For "Home" license? For "Student" license?
For a student who needs MATLAB on two machines with often switch between the two.
What would be the right license – "Student" or "Home"
ThanksCan MATLAB be installed on two computers? Or, how often can a license be transferred between two computers?
For "Home" license? For "Student" license?
For a student who needs MATLAB on two machines with often switch between the two.
What would be the right license – "Student" or "Home"
Thanks Can MATLAB be installed on two computers? Or, how often can a license be transferred between two computers?
For "Home" license? For "Student" license?
For a student who needs MATLAB on two machines with often switch between the two.
What would be the right license – "Student" or "Home"
Thanks license transfer MATLAB Answers — New Questions









