Category: Matlab
Category Archives: Matlab
Best book for beginners
Hi all, this year I have started University and I would like to learn about Matlab. I have never seen nothing about this programme, so I ask you, which book do you suggest for beginners? I’m Italian but I want study English more as possible, so I prefer English books.
I see this book: *Matlab for Beginners: A Gentle Approach*
How is it?
Regards, AlessandroHi all, this year I have started University and I would like to learn about Matlab. I have never seen nothing about this programme, so I ask you, which book do you suggest for beginners? I’m Italian but I want study English more as possible, so I prefer English books.
I see this book: *Matlab for Beginners: A Gentle Approach*
How is it?
Regards, Alessandro Hi all, this year I have started University and I would like to learn about Matlab. I have never seen nothing about this programme, so I ask you, which book do you suggest for beginners? I’m Italian but I want study English more as possible, so I prefer English books.
I see this book: *Matlab for Beginners: A Gentle Approach*
How is it?
Regards, Alessandro book, beginners MATLAB Answers — New Questions
Difficulty installing Biosig after EEGLAB install on Macbook
I’m a really rudimentary Matlab/EEGLAB user, and I’m also PC literate rather than Mac. I have a student I’m onboarding to be a research assistant who uses a Macbook, and we have installed Matlab and EEGLab successfully on her machine, as well as the frontal asymmetry toolbox, using the Add On manager in Matlab. EEGLab opens fine on the Macbook and we have since tried to open an EDF file using the Biosig tools option. EEGLAB then attempts to download and install Biosig (which on my PC has always gone smoothly). However, my student keeps getting this message:
"Could not download extension. Host site might be unavailable, too slow or you do not have permission to write in the EEGLAB plugin folder. Try again just in case or use a faster connection.
Alternatively install the plugin manually by downloading it at http://sccn.ucsd.edu/wiki/EEGLAB_Extensions_and_plug-ins
unziping it in the eeglab/plugin folder and restarting eeglab"
We have downloaded Biosig from the host website and attempted to manually place it in the correct folder in EEGLAB on the Macbook, but when we attempt to open the EDF file, EEGLAB continues to try to download Biosig itself and gives us the same error message. The error message occurs regardless of what wireless network she is on, whether at home or at the university. We have checked the permissions of Matlab folder to ensure she can modify it, that’s fine. Is this problem particular to the Mac OS? How do we get this running?I’m a really rudimentary Matlab/EEGLAB user, and I’m also PC literate rather than Mac. I have a student I’m onboarding to be a research assistant who uses a Macbook, and we have installed Matlab and EEGLab successfully on her machine, as well as the frontal asymmetry toolbox, using the Add On manager in Matlab. EEGLab opens fine on the Macbook and we have since tried to open an EDF file using the Biosig tools option. EEGLAB then attempts to download and install Biosig (which on my PC has always gone smoothly). However, my student keeps getting this message:
"Could not download extension. Host site might be unavailable, too slow or you do not have permission to write in the EEGLAB plugin folder. Try again just in case or use a faster connection.
Alternatively install the plugin manually by downloading it at http://sccn.ucsd.edu/wiki/EEGLAB_Extensions_and_plug-ins
unziping it in the eeglab/plugin folder and restarting eeglab"
We have downloaded Biosig from the host website and attempted to manually place it in the correct folder in EEGLAB on the Macbook, but when we attempt to open the EDF file, EEGLAB continues to try to download Biosig itself and gives us the same error message. The error message occurs regardless of what wireless network she is on, whether at home or at the university. We have checked the permissions of Matlab folder to ensure she can modify it, that’s fine. Is this problem particular to the Mac OS? How do we get this running? I’m a really rudimentary Matlab/EEGLAB user, and I’m also PC literate rather than Mac. I have a student I’m onboarding to be a research assistant who uses a Macbook, and we have installed Matlab and EEGLab successfully on her machine, as well as the frontal asymmetry toolbox, using the Add On manager in Matlab. EEGLab opens fine on the Macbook and we have since tried to open an EDF file using the Biosig tools option. EEGLAB then attempts to download and install Biosig (which on my PC has always gone smoothly). However, my student keeps getting this message:
"Could not download extension. Host site might be unavailable, too slow or you do not have permission to write in the EEGLAB plugin folder. Try again just in case or use a faster connection.
Alternatively install the plugin manually by downloading it at http://sccn.ucsd.edu/wiki/EEGLAB_Extensions_and_plug-ins
unziping it in the eeglab/plugin folder and restarting eeglab"
We have downloaded Biosig from the host website and attempted to manually place it in the correct folder in EEGLAB on the Macbook, but when we attempt to open the EDF file, EEGLAB continues to try to download Biosig itself and gives us the same error message. The error message occurs regardless of what wireless network she is on, whether at home or at the university. We have checked the permissions of Matlab folder to ensure she can modify it, that’s fine. Is this problem particular to the Mac OS? How do we get this running? installation, mac, biosig MATLAB Answers — New Questions
I’m trying to plot a mat file with a 1×1 structure, but it’s giving the error that “Index in position 2 exceeds array bounds. Index must not exceed 1.”
data1 = load(‘radial.mat’); % Assume data is [X1 Y1] for file1
plot(data1(:,1), data1(:,2), ‘g’, ‘DisplayName’, ‘File 2’);data1 = load(‘radial.mat’); % Assume data is [X1 Y1] for file1
plot(data1(:,1), data1(:,2), ‘g’, ‘DisplayName’, ‘File 2’); data1 = load(‘radial.mat’); % Assume data is [X1 Y1] for file1
plot(data1(:,1), data1(:,2), ‘g’, ‘DisplayName’, ‘File 2’); matlab MATLAB Answers — New Questions
what is this block called
Hi,
What is this block called?Hi,
What is this block called? Hi,
What is this block called? simulink MATLAB Answers — New Questions
Hi everybody. I’m kind of new to MATLAb and looking to get more efficient in my coding. This feels clunky to me and I feel like I could definitely shorten it. Any ideas?
Engine = ["LO2/LH2";"LO2/CH4";"STP low ISP";"STP high ISP"];
ISP = [450;312;250;500];
DryMass = [3;6;6;12];
MaxPropellantMass = [50;50;50;50];
g = 9.81;
ve = (g*ISP)/1000;
mi = DryMass + MaxPropellantMass;
mf = DryMass;
DeltaV = zeros(1,4);
mf_DV2 = zeros(4,1);
Prop_Delivered = zeros(1,4);
DV2 = 2;
Pd_LOx_LH2 = zeros(1,8);
Pd_LOx_CH4 = zeros(1,8);
Pd_STP_H = zeros(1,8);
Pd_STP_L = zeros(1,8);
for f = 1:4
DeltaV(f) = ve(f,1)*log(mi(f,1)/mf(f,1));
mf_DV2(f) = mi(f,1)/(exp(DV2/(ve(f,1))));
Prop_Delivered(f) = mf_DV2(f,1) – DryMass(f,1);
end
DeltaV = DeltaV’;
Problem_1 = table(Engine,ISP,DryMass,MaxPropellantMass,DeltaV);
Problem_1 = renamevars(Problem_1,["DryMass","MaxPropellantMass","DeltaV"], …
["Dry Mass (mT)","Max Propellant Mass (mT)","DeltaV (km/s)"])
Prop_Delivered = Prop_Delivered’;
Problem_2 = table(Engine,mf_DV2,Prop_Delivered);
Problem_2 = renamevars(Problem_2,["mf_DV2","Prop_Delivered"], …
["Final Mass (mT)","Delivered Propellant (mT)"])
for dv = 1:8
Pd_LOx_LH2(dv) = (mi(1,1)/exp(dv/ve(1,1)))-DryMass(1,1);
Pd_LOx_CH4(dv) = (mi(2,1)/exp(dv/ve(2,1)))-DryMass(2,1);
Pd_STP_L(dv) = (mi(3,1)/exp(dv/ve(3,1)))-DryMass(3,1);
Pd_STP_H(dv) = (mi(4,1)/exp(dv/ve(4,1)))-DryMass(4,1);
end
x = 1:0.5:8;
LOx_LH2 = (mi(1)./exp(x/ve(1)))-DryMass(1);
LOx_CH4 = (mi(2)./exp(x/ve(2)))-DryMass(2);
STP_L = (mi(3)./exp(x/ve(3)))-DryMass(3);
STP_H = (mi(4)./exp(x/ve(4)))-DryMass(4);
plot(x,LOx_LH2,x,LOx_CH4,x,STP_L,x,STP_H)
% Add title and axis labels
title(‘Propellant Delivered (mT) Per DeltaV (km/s)’);
xlabel(‘DeltaV’);
ylabel(‘Propellant Delivered’);
% Add legend
legend(‘LOx/LH2′,’LOx/CH4′,’STP Low ISP’,’STP High ISP’);
Problem_3 = table((1:8)’,Pd_LOx_LH2′,Pd_LOx_CH4′,Pd_STP_L’,Pd_STP_H’);
Problem_3 = renamevars(Problem_3,["Var1","Var2","Var3","Var4","Var5"], …
["DeltaV","LOx/LH2","LOx/CH4","STP Low ISP","STP High ISP"])Engine = ["LO2/LH2";"LO2/CH4";"STP low ISP";"STP high ISP"];
ISP = [450;312;250;500];
DryMass = [3;6;6;12];
MaxPropellantMass = [50;50;50;50];
g = 9.81;
ve = (g*ISP)/1000;
mi = DryMass + MaxPropellantMass;
mf = DryMass;
DeltaV = zeros(1,4);
mf_DV2 = zeros(4,1);
Prop_Delivered = zeros(1,4);
DV2 = 2;
Pd_LOx_LH2 = zeros(1,8);
Pd_LOx_CH4 = zeros(1,8);
Pd_STP_H = zeros(1,8);
Pd_STP_L = zeros(1,8);
for f = 1:4
DeltaV(f) = ve(f,1)*log(mi(f,1)/mf(f,1));
mf_DV2(f) = mi(f,1)/(exp(DV2/(ve(f,1))));
Prop_Delivered(f) = mf_DV2(f,1) – DryMass(f,1);
end
DeltaV = DeltaV’;
Problem_1 = table(Engine,ISP,DryMass,MaxPropellantMass,DeltaV);
Problem_1 = renamevars(Problem_1,["DryMass","MaxPropellantMass","DeltaV"], …
["Dry Mass (mT)","Max Propellant Mass (mT)","DeltaV (km/s)"])
Prop_Delivered = Prop_Delivered’;
Problem_2 = table(Engine,mf_DV2,Prop_Delivered);
Problem_2 = renamevars(Problem_2,["mf_DV2","Prop_Delivered"], …
["Final Mass (mT)","Delivered Propellant (mT)"])
for dv = 1:8
Pd_LOx_LH2(dv) = (mi(1,1)/exp(dv/ve(1,1)))-DryMass(1,1);
Pd_LOx_CH4(dv) = (mi(2,1)/exp(dv/ve(2,1)))-DryMass(2,1);
Pd_STP_L(dv) = (mi(3,1)/exp(dv/ve(3,1)))-DryMass(3,1);
Pd_STP_H(dv) = (mi(4,1)/exp(dv/ve(4,1)))-DryMass(4,1);
end
x = 1:0.5:8;
LOx_LH2 = (mi(1)./exp(x/ve(1)))-DryMass(1);
LOx_CH4 = (mi(2)./exp(x/ve(2)))-DryMass(2);
STP_L = (mi(3)./exp(x/ve(3)))-DryMass(3);
STP_H = (mi(4)./exp(x/ve(4)))-DryMass(4);
plot(x,LOx_LH2,x,LOx_CH4,x,STP_L,x,STP_H)
% Add title and axis labels
title(‘Propellant Delivered (mT) Per DeltaV (km/s)’);
xlabel(‘DeltaV’);
ylabel(‘Propellant Delivered’);
% Add legend
legend(‘LOx/LH2′,’LOx/CH4′,’STP Low ISP’,’STP High ISP’);
Problem_3 = table((1:8)’,Pd_LOx_LH2′,Pd_LOx_CH4′,Pd_STP_L’,Pd_STP_H’);
Problem_3 = renamevars(Problem_3,["Var1","Var2","Var3","Var4","Var5"], …
["DeltaV","LOx/LH2","LOx/CH4","STP Low ISP","STP High ISP"]) Engine = ["LO2/LH2";"LO2/CH4";"STP low ISP";"STP high ISP"];
ISP = [450;312;250;500];
DryMass = [3;6;6;12];
MaxPropellantMass = [50;50;50;50];
g = 9.81;
ve = (g*ISP)/1000;
mi = DryMass + MaxPropellantMass;
mf = DryMass;
DeltaV = zeros(1,4);
mf_DV2 = zeros(4,1);
Prop_Delivered = zeros(1,4);
DV2 = 2;
Pd_LOx_LH2 = zeros(1,8);
Pd_LOx_CH4 = zeros(1,8);
Pd_STP_H = zeros(1,8);
Pd_STP_L = zeros(1,8);
for f = 1:4
DeltaV(f) = ve(f,1)*log(mi(f,1)/mf(f,1));
mf_DV2(f) = mi(f,1)/(exp(DV2/(ve(f,1))));
Prop_Delivered(f) = mf_DV2(f,1) – DryMass(f,1);
end
DeltaV = DeltaV’;
Problem_1 = table(Engine,ISP,DryMass,MaxPropellantMass,DeltaV);
Problem_1 = renamevars(Problem_1,["DryMass","MaxPropellantMass","DeltaV"], …
["Dry Mass (mT)","Max Propellant Mass (mT)","DeltaV (km/s)"])
Prop_Delivered = Prop_Delivered’;
Problem_2 = table(Engine,mf_DV2,Prop_Delivered);
Problem_2 = renamevars(Problem_2,["mf_DV2","Prop_Delivered"], …
["Final Mass (mT)","Delivered Propellant (mT)"])
for dv = 1:8
Pd_LOx_LH2(dv) = (mi(1,1)/exp(dv/ve(1,1)))-DryMass(1,1);
Pd_LOx_CH4(dv) = (mi(2,1)/exp(dv/ve(2,1)))-DryMass(2,1);
Pd_STP_L(dv) = (mi(3,1)/exp(dv/ve(3,1)))-DryMass(3,1);
Pd_STP_H(dv) = (mi(4,1)/exp(dv/ve(4,1)))-DryMass(4,1);
end
x = 1:0.5:8;
LOx_LH2 = (mi(1)./exp(x/ve(1)))-DryMass(1);
LOx_CH4 = (mi(2)./exp(x/ve(2)))-DryMass(2);
STP_L = (mi(3)./exp(x/ve(3)))-DryMass(3);
STP_H = (mi(4)./exp(x/ve(4)))-DryMass(4);
plot(x,LOx_LH2,x,LOx_CH4,x,STP_L,x,STP_H)
% Add title and axis labels
title(‘Propellant Delivered (mT) Per DeltaV (km/s)’);
xlabel(‘DeltaV’);
ylabel(‘Propellant Delivered’);
% Add legend
legend(‘LOx/LH2′,’LOx/CH4′,’STP Low ISP’,’STP High ISP’);
Problem_3 = table((1:8)’,Pd_LOx_LH2′,Pd_LOx_CH4′,Pd_STP_L’,Pd_STP_H’);
Problem_3 = renamevars(Problem_3,["Var1","Var2","Var3","Var4","Var5"], …
["DeltaV","LOx/LH2","LOx/CH4","STP Low ISP","STP High ISP"]) shortening, efficiency, learning MATLAB Answers — New Questions
Why Rapid Accelerator Simulation fails with Visual Studio Compiler error: “rt_nonfinite.c(4): error C2099: initializer is not a constant rt_nonfinite.c(5): error C2099: initializer is not a constant” ?
I got the following error message when run Rapid Accelerator simulation using Windows SDK Version 10.0.26100.0.
** Error message **
cl -c -nologo -GS -W4 -DWIN32 @test_comp.rsp -D_MT -D_DLL -MD -D_CRT_SECURE_NO_WARNINGS -DTGTCONN -DIS_SIM_TARGET -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DUSE_LOCALHOST -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=0 -DTID01EQ=1 /DNDEBUG /Od /Oy- -DMODEL=test -DNUMST=2 -DNCSTATES=0 -DMAT_FILE=1 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE -DIS_RAPID_ACCEL -DHAVESTDIO -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 rt_nonfinite.c
rt_nonfinite.c
rt_nonfinite.c(4): error C2099: initializer is not a constant
rt_nonfinite.c(5): error C2099: initializer is not a constant
NMAKE : fatal error U1077: ‘cl -c -nologo -GS -W4 -DWIN32 @test_comp.rsp -D_MT -D_DLL -MD -D_CRT_SECURE_NO_WARNINGS -DTGTCONN -DIS_SIM_TARGET -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DUSE_LOCALHOST -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=0 -DTID01EQ=1 /DNDEBUG /Od /Oy- -DMODEL=test -DNUMST=2 -DNCSTATES=0 -DMAT_FILE=1 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE -DIS_RAPID_ACCEL -DHAVESTDIO -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 rt_nonfinite.c ‘ : return code ‘0x2’
Stop.
**I got the following error message when run Rapid Accelerator simulation using Windows SDK Version 10.0.26100.0.
** Error message **
cl -c -nologo -GS -W4 -DWIN32 @test_comp.rsp -D_MT -D_DLL -MD -D_CRT_SECURE_NO_WARNINGS -DTGTCONN -DIS_SIM_TARGET -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DUSE_LOCALHOST -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=0 -DTID01EQ=1 /DNDEBUG /Od /Oy- -DMODEL=test -DNUMST=2 -DNCSTATES=0 -DMAT_FILE=1 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE -DIS_RAPID_ACCEL -DHAVESTDIO -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 rt_nonfinite.c
rt_nonfinite.c
rt_nonfinite.c(4): error C2099: initializer is not a constant
rt_nonfinite.c(5): error C2099: initializer is not a constant
NMAKE : fatal error U1077: ‘cl -c -nologo -GS -W4 -DWIN32 @test_comp.rsp -D_MT -D_DLL -MD -D_CRT_SECURE_NO_WARNINGS -DTGTCONN -DIS_SIM_TARGET -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DUSE_LOCALHOST -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=0 -DTID01EQ=1 /DNDEBUG /Od /Oy- -DMODEL=test -DNUMST=2 -DNCSTATES=0 -DMAT_FILE=1 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE -DIS_RAPID_ACCEL -DHAVESTDIO -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 rt_nonfinite.c ‘ : return code ‘0x2’
Stop.
** I got the following error message when run Rapid Accelerator simulation using Windows SDK Version 10.0.26100.0.
** Error message **
cl -c -nologo -GS -W4 -DWIN32 @test_comp.rsp -D_MT -D_DLL -MD -D_CRT_SECURE_NO_WARNINGS -DTGTCONN -DIS_SIM_TARGET -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DUSE_LOCALHOST -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=0 -DTID01EQ=1 /DNDEBUG /Od /Oy- -DMODEL=test -DNUMST=2 -DNCSTATES=0 -DMAT_FILE=1 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE -DIS_RAPID_ACCEL -DHAVESTDIO -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 rt_nonfinite.c
rt_nonfinite.c
rt_nonfinite.c(4): error C2099: initializer is not a constant
rt_nonfinite.c(5): error C2099: initializer is not a constant
NMAKE : fatal error U1077: ‘cl -c -nologo -GS -W4 -DWIN32 @test_comp.rsp -D_MT -D_DLL -MD -D_CRT_SECURE_NO_WARNINGS -DTGTCONN -DIS_SIM_TARGET -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DUSE_LOCALHOST -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=0 -DTID01EQ=1 /DNDEBUG /Od /Oy- -DMODEL=test -DNUMST=2 -DNCSTATES=0 -DMAT_FILE=1 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE -DIS_RAPID_ACCEL -DHAVESTDIO -DMT=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 rt_nonfinite.c ‘ : return code ‘0x2’
Stop.
** MATLAB Answers — New Questions
Simulink state space observer output issue
Hello everyone. For my simulink state space observer system, I set up two models based on the same system. One model that doesn’t use the ‘state space block’, and another one that uses the ‘state space block’. The ‘state space block’ was configured (with the A, B, C, D matrices) to be the equivalent to my graphical interconnected blocks observer system model.
The output of the graphical interconnected block observer model is mostly satisfactory – except, I notice that the plotted output always spikes or rockets up to large value at the ‘end time’. So if I choose a simulation end-time of 0.5 seconds, then the spike occurs at 0.5 seconds. And if I choose the simulation end time to end at 10 seconds, then the spike will occur at 10 seconds, while the general output response is satisfactory for times well below 10 seconds. Same if I were to choose an end time of 20 seconds. The spike would occur at 20 seconds.
However, for the compact ‘state space block’ model of the observer system. Equivalent system. The output never gets that spiking (which is good).
Woud anyone have any ideas about the reason for spiking seen only at the end-time? And anything we can try – so that the spike at the end time doesn’t occur for the blocks-connected observer model? Thanks all!Hello everyone. For my simulink state space observer system, I set up two models based on the same system. One model that doesn’t use the ‘state space block’, and another one that uses the ‘state space block’. The ‘state space block’ was configured (with the A, B, C, D matrices) to be the equivalent to my graphical interconnected blocks observer system model.
The output of the graphical interconnected block observer model is mostly satisfactory – except, I notice that the plotted output always spikes or rockets up to large value at the ‘end time’. So if I choose a simulation end-time of 0.5 seconds, then the spike occurs at 0.5 seconds. And if I choose the simulation end time to end at 10 seconds, then the spike will occur at 10 seconds, while the general output response is satisfactory for times well below 10 seconds. Same if I were to choose an end time of 20 seconds. The spike would occur at 20 seconds.
However, for the compact ‘state space block’ model of the observer system. Equivalent system. The output never gets that spiking (which is good).
Woud anyone have any ideas about the reason for spiking seen only at the end-time? And anything we can try – so that the spike at the end time doesn’t occur for the blocks-connected observer model? Thanks all! Hello everyone. For my simulink state space observer system, I set up two models based on the same system. One model that doesn’t use the ‘state space block’, and another one that uses the ‘state space block’. The ‘state space block’ was configured (with the A, B, C, D matrices) to be the equivalent to my graphical interconnected blocks observer system model.
The output of the graphical interconnected block observer model is mostly satisfactory – except, I notice that the plotted output always spikes or rockets up to large value at the ‘end time’. So if I choose a simulation end-time of 0.5 seconds, then the spike occurs at 0.5 seconds. And if I choose the simulation end time to end at 10 seconds, then the spike will occur at 10 seconds, while the general output response is satisfactory for times well below 10 seconds. Same if I were to choose an end time of 20 seconds. The spike would occur at 20 seconds.
However, for the compact ‘state space block’ model of the observer system. Equivalent system. The output never gets that spiking (which is good).
Woud anyone have any ideas about the reason for spiking seen only at the end-time? And anything we can try – so that the spike at the end time doesn’t occur for the blocks-connected observer model? Thanks all! simulink observer MATLAB Answers — New Questions
Group Data for one Legend in Figure of Multiple SubPlots
Hi All,
I am working with several instances that I want to plot data for each with their own data set. For example I have four plots with their own respective signals I need to look at and for multiple instances. Each instance is comprised of several variations that I need to be of the same color. In each plot each instance is colored differently but each data set of variations is one color based on instance. I have been scouring the internet for help on this but I can’t seem to get any solution to this issue.
What i would like to do is have one legend (and yes I know i could just add a legend to one of my subplots and move it) that only has the different instances and their respective colors without adding in all of the variations within the data set. I have a loop set up to plot 5 variations per instance and I was hoping to loop this through instances that use different files. Below is kind of the code I’ve been working around and trying to make work. Its just a section for ease, but basically lets say I have 5 instances and each has 5 variations, I can plot them and ensure each variation is the same color so i have 5 different colors on the plots, but I want a legent just to show the 5 instances in their respective colors and not 25 for evry line.
Please help me out here, I am starting to go nuts and found some very terrible ways of diong this by hand which aren’t applicable at all.
for z = 1:num files;
subplot(1,2,2);
hold on
grid on;
for i = 1:5
plot(z) = plot(StartA(:,i),AMA_1(:,i),color)
end
end
legend(plot(1),plot(2), etc…Hi All,
I am working with several instances that I want to plot data for each with their own data set. For example I have four plots with their own respective signals I need to look at and for multiple instances. Each instance is comprised of several variations that I need to be of the same color. In each plot each instance is colored differently but each data set of variations is one color based on instance. I have been scouring the internet for help on this but I can’t seem to get any solution to this issue.
What i would like to do is have one legend (and yes I know i could just add a legend to one of my subplots and move it) that only has the different instances and their respective colors without adding in all of the variations within the data set. I have a loop set up to plot 5 variations per instance and I was hoping to loop this through instances that use different files. Below is kind of the code I’ve been working around and trying to make work. Its just a section for ease, but basically lets say I have 5 instances and each has 5 variations, I can plot them and ensure each variation is the same color so i have 5 different colors on the plots, but I want a legent just to show the 5 instances in their respective colors and not 25 for evry line.
Please help me out here, I am starting to go nuts and found some very terrible ways of diong this by hand which aren’t applicable at all.
for z = 1:num files;
subplot(1,2,2);
hold on
grid on;
for i = 1:5
plot(z) = plot(StartA(:,i),AMA_1(:,i),color)
end
end
legend(plot(1),plot(2), etc… Hi All,
I am working with several instances that I want to plot data for each with their own data set. For example I have four plots with their own respective signals I need to look at and for multiple instances. Each instance is comprised of several variations that I need to be of the same color. In each plot each instance is colored differently but each data set of variations is one color based on instance. I have been scouring the internet for help on this but I can’t seem to get any solution to this issue.
What i would like to do is have one legend (and yes I know i could just add a legend to one of my subplots and move it) that only has the different instances and their respective colors without adding in all of the variations within the data set. I have a loop set up to plot 5 variations per instance and I was hoping to loop this through instances that use different files. Below is kind of the code I’ve been working around and trying to make work. Its just a section for ease, but basically lets say I have 5 instances and each has 5 variations, I can plot them and ensure each variation is the same color so i have 5 different colors on the plots, but I want a legent just to show the 5 instances in their respective colors and not 25 for evry line.
Please help me out here, I am starting to go nuts and found some very terrible ways of diong this by hand which aren’t applicable at all.
for z = 1:num files;
subplot(1,2,2);
hold on
grid on;
for i = 1:5
plot(z) = plot(StartA(:,i),AMA_1(:,i),color)
end
end
legend(plot(1),plot(2), etc… subplot, legend, figure, plotting MATLAB Answers — New Questions
How to insert space between strings while doing strcat ?
for eg:
a=’hello’; b=’world’; strcat(a,b);
strcat(a,b) gives ‘helloworld’ But I need it as ‘hello world’ How can I do that ?for eg:
a=’hello’; b=’world’; strcat(a,b);
strcat(a,b) gives ‘helloworld’ But I need it as ‘hello world’ How can I do that ? for eg:
a=’hello’; b=’world’; strcat(a,b);
strcat(a,b) gives ‘helloworld’ But I need it as ‘hello world’ How can I do that ? string MATLAB Answers — New Questions
How can i simulate a system that have modeled by openmodelica in matlab freely not by dymola matlab interface and fmu?
Hi friends,
I want to use the model that have modeled by OpenModelica in MATLAB. But i need to do this freely not by fmu MATLAB toolbox or dymola Matlab interface. Could you please guide me how?
Can i generate *.dll file by openmodelica and then use this *.dll file in matlab s-function.
I am a beginner in modelica.
Thanks for your attention.Hi friends,
I want to use the model that have modeled by OpenModelica in MATLAB. But i need to do this freely not by fmu MATLAB toolbox or dymola Matlab interface. Could you please guide me how?
Can i generate *.dll file by openmodelica and then use this *.dll file in matlab s-function.
I am a beginner in modelica.
Thanks for your attention. Hi friends,
I want to use the model that have modeled by OpenModelica in MATLAB. But i need to do this freely not by fmu MATLAB toolbox or dymola Matlab interface. Could you please guide me how?
Can i generate *.dll file by openmodelica and then use this *.dll file in matlab s-function.
I am a beginner in modelica.
Thanks for your attention. modelica matlab interface MATLAB Answers — New Questions
How to draw a combined efficiency map
Hi expert,
I have two effiency maps, one for engine and one for generator and their operating curves like below. I want to obtain the maximum efficiency data, that is when speed from 0~600 rad/s, torque = the smaller value of maximum torque of genrator and engine(torque limitation), and effiency = efficiency of genrator * efficiency of engine.
The data file sizes are:
w_eg_row: 1*9 genrator speed
T_eg_col: 15*1 generator torque
eta_EG_map: 9*15 efficiency of generator
T_EG_max: 9*1 maximum torque versus speed
w_ce_row: 1*15 genrator speed
T_ce_col: 1*16 generator torque
eta_ce_map: 16*15 efficiency of generator
T_ce_max: 1*15 maximum torque versus speed
I don’t know how to process the data to get the result. Could you please provide the code?Hi expert,
I have two effiency maps, one for engine and one for generator and their operating curves like below. I want to obtain the maximum efficiency data, that is when speed from 0~600 rad/s, torque = the smaller value of maximum torque of genrator and engine(torque limitation), and effiency = efficiency of genrator * efficiency of engine.
The data file sizes are:
w_eg_row: 1*9 genrator speed
T_eg_col: 15*1 generator torque
eta_EG_map: 9*15 efficiency of generator
T_EG_max: 9*1 maximum torque versus speed
w_ce_row: 1*15 genrator speed
T_ce_col: 1*16 generator torque
eta_ce_map: 16*15 efficiency of generator
T_ce_max: 1*15 maximum torque versus speed
I don’t know how to process the data to get the result. Could you please provide the code? Hi expert,
I have two effiency maps, one for engine and one for generator and their operating curves like below. I want to obtain the maximum efficiency data, that is when speed from 0~600 rad/s, torque = the smaller value of maximum torque of genrator and engine(torque limitation), and effiency = efficiency of genrator * efficiency of engine.
The data file sizes are:
w_eg_row: 1*9 genrator speed
T_eg_col: 15*1 generator torque
eta_EG_map: 9*15 efficiency of generator
T_EG_max: 9*1 maximum torque versus speed
w_ce_row: 1*15 genrator speed
T_ce_col: 1*16 generator torque
eta_ce_map: 16*15 efficiency of generator
T_ce_max: 1*15 maximum torque versus speed
I don’t know how to process the data to get the result. Could you please provide the code? efficiency map MATLAB Answers — New Questions
Difficulty Getting to MPP via Incremental Conductance on Simulink.
%CODE
function out = fcn(V, I, Vo, Io, d, step)
dv = V – Vo;
di = I – Io;
if(dv == 0)
if(di == 0)
out = d;
else
if(di > 0)
%increase duty cycle
d=d-step;
else
%decrease duty cycle
d=d+step;
end
out = d;
end
else
if(di/dv == -(I/V))
out = d;
else
if(di/dv > -(I/V))
%decrease duty cycle
d=d-step;
else
%increase duty cycle
d=d+step;
end
out = d;
end
end
%CODE
We have this model for Inc Cond for solar panel MPPT project. The code is also provided for the block, our output used to be perfect when our power gui was set to 1e-7 but our other models are using 1e-6 and we have tried messing with the step size constant to no avail. We are unsure what is going on, if it is relevant we are using a synchronous buck converter for the output of our solar panel.%CODE
function out = fcn(V, I, Vo, Io, d, step)
dv = V – Vo;
di = I – Io;
if(dv == 0)
if(di == 0)
out = d;
else
if(di > 0)
%increase duty cycle
d=d-step;
else
%decrease duty cycle
d=d+step;
end
out = d;
end
else
if(di/dv == -(I/V))
out = d;
else
if(di/dv > -(I/V))
%decrease duty cycle
d=d-step;
else
%increase duty cycle
d=d+step;
end
out = d;
end
end
%CODE
We have this model for Inc Cond for solar panel MPPT project. The code is also provided for the block, our output used to be perfect when our power gui was set to 1e-7 but our other models are using 1e-6 and we have tried messing with the step size constant to no avail. We are unsure what is going on, if it is relevant we are using a synchronous buck converter for the output of our solar panel. %CODE
function out = fcn(V, I, Vo, Io, d, step)
dv = V – Vo;
di = I – Io;
if(dv == 0)
if(di == 0)
out = d;
else
if(di > 0)
%increase duty cycle
d=d-step;
else
%decrease duty cycle
d=d+step;
end
out = d;
end
else
if(di/dv == -(I/V))
out = d;
else
if(di/dv > -(I/V))
%decrease duty cycle
d=d-step;
else
%increase duty cycle
d=d+step;
end
out = d;
end
end
%CODE
We have this model for Inc Cond for solar panel MPPT project. The code is also provided for the block, our output used to be perfect when our power gui was set to 1e-7 but our other models are using 1e-6 and we have tried messing with the step size constant to no avail. We are unsure what is going on, if it is relevant we are using a synchronous buck converter for the output of our solar panel. mppt, simulink, inccond MATLAB Answers — New Questions
automating many column headings in table
I have a 10000×400 matrix, plotphys, I want to turn into a table and add variable names to. I understand that can be done easily with the array2table function. However adding 400 headings is a lot; luckily I want the headings uniform in that they would be labeled
‘phys state at tstep 1’, ‘phys state at tstep 2’, …, ‘phys state at tstep 400’
Is there a way I can basically automate the creation of the headings?
I tried this
head = join("phys state at tstep " + [1:1:400]);
phystable = array2table(plotphys, ‘VariableNames’, {head});
but that did not workI have a 10000×400 matrix, plotphys, I want to turn into a table and add variable names to. I understand that can be done easily with the array2table function. However adding 400 headings is a lot; luckily I want the headings uniform in that they would be labeled
‘phys state at tstep 1’, ‘phys state at tstep 2’, …, ‘phys state at tstep 400’
Is there a way I can basically automate the creation of the headings?
I tried this
head = join("phys state at tstep " + [1:1:400]);
phystable = array2table(plotphys, ‘VariableNames’, {head});
but that did not work I have a 10000×400 matrix, plotphys, I want to turn into a table and add variable names to. I understand that can be done easily with the array2table function. However adding 400 headings is a lot; luckily I want the headings uniform in that they would be labeled
‘phys state at tstep 1’, ‘phys state at tstep 2’, …, ‘phys state at tstep 400’
Is there a way I can basically automate the creation of the headings?
I tried this
head = join("phys state at tstep " + [1:1:400]);
phystable = array2table(plotphys, ‘VariableNames’, {head});
but that did not work table, headings MATLAB Answers — New Questions
Error OF C2000 in TMS320F28335
Dear Sir or Madam
I am writing to thank you for the sample program for the simulation of the Texas Instruments c2000 with the f28335 model. However, But I changed the blocks to the model f28335 and finally the error came with the following response..
I would be grateful if you could provide me with the model I need. Thank you very much for your help.
Sincerely
Mohsen Teimoori
"Error evaluating ‘InitFcn’ callback of ADC Type 3-5 block (mask) ‘f28335_sixstep_controlBLDC/Current Control/Sensor Driver Blocks/Sensor Driver Blocks (codegen)/Current Measurment/ADC5’.
Callback string is ‘validatePiccoloADC;
codertarget.registry.registerPiccoloADCBlocks(gcb);’
Caused by:
The values of the parameter SOC trigger on the blocks ADC5 and ADC5 must be different."Dear Sir or Madam
I am writing to thank you for the sample program for the simulation of the Texas Instruments c2000 with the f28335 model. However, But I changed the blocks to the model f28335 and finally the error came with the following response..
I would be grateful if you could provide me with the model I need. Thank you very much for your help.
Sincerely
Mohsen Teimoori
"Error evaluating ‘InitFcn’ callback of ADC Type 3-5 block (mask) ‘f28335_sixstep_controlBLDC/Current Control/Sensor Driver Blocks/Sensor Driver Blocks (codegen)/Current Measurment/ADC5’.
Callback string is ‘validatePiccoloADC;
codertarget.registry.registerPiccoloADCBlocks(gcb);’
Caused by:
The values of the parameter SOC trigger on the blocks ADC5 and ADC5 must be different." Dear Sir or Madam
I am writing to thank you for the sample program for the simulation of the Texas Instruments c2000 with the f28335 model. However, But I changed the blocks to the model f28335 and finally the error came with the following response..
I would be grateful if you could provide me with the model I need. Thank you very much for your help.
Sincerely
Mohsen Teimoori
"Error evaluating ‘InitFcn’ callback of ADC Type 3-5 block (mask) ‘f28335_sixstep_controlBLDC/Current Control/Sensor Driver Blocks/Sensor Driver Blocks (codegen)/Current Measurment/ADC5’.
Callback string is ‘validatePiccoloADC;
codertarget.registry.registerPiccoloADCBlocks(gcb);’
Caused by:
The values of the parameter SOC trigger on the blocks ADC5 and ADC5 must be different." c2000 and bldc motor control MATLAB Answers — New Questions
Finding specific peaks and valleys
I have a periodic signal with 6 peaks and 6 valleys. I am able to find all 6 peaks and all 6 valleys using the code below:
% plot periodic signal
plot(angle,signal)
hold on;
% fit to avoid noisy oscillations and find 6 global peaks
f = fit(angle,signal,’sin9′);
yfitted = feval(f,angle);
plot(angle,yfitted,’r’)
% find peaks and corresponding angles
[ypk0,idx0] = findpeaks(yfitted);
peaks = signal(idx0);
max_angles = angle(idx0);
% invert fitted signal to find 6 global valleys and corresponding angles
yfittedinv = max(yfitted) – yfitted;
[ypk,idx] = findpeaks(yfittedinv);
valleys = signal(idx);
min_angles = angle(idx);
Furthermore, I am able to find the global minimum (i.e., the lowest valley) using this line:
% find the global minimum
minangle = min_angles(valleys == min(valleys));
Both the arrays "max_angles" and "min_angles" have 6 elements. The question is how to reduce the number of elements in the array "min_angles" from 6 to 3, where I will have only the global minimum and the 2 non-neighbor valleys. The attached pic should help. I am able to find the green circle, but I also need to find the 2 red circles. Note that the global valley (green circle) is not always in the middle. It can be the first element of the array "min_angles", or it can be the last one. In the picture below, it’s number 4.I have a periodic signal with 6 peaks and 6 valleys. I am able to find all 6 peaks and all 6 valleys using the code below:
% plot periodic signal
plot(angle,signal)
hold on;
% fit to avoid noisy oscillations and find 6 global peaks
f = fit(angle,signal,’sin9′);
yfitted = feval(f,angle);
plot(angle,yfitted,’r’)
% find peaks and corresponding angles
[ypk0,idx0] = findpeaks(yfitted);
peaks = signal(idx0);
max_angles = angle(idx0);
% invert fitted signal to find 6 global valleys and corresponding angles
yfittedinv = max(yfitted) – yfitted;
[ypk,idx] = findpeaks(yfittedinv);
valleys = signal(idx);
min_angles = angle(idx);
Furthermore, I am able to find the global minimum (i.e., the lowest valley) using this line:
% find the global minimum
minangle = min_angles(valleys == min(valleys));
Both the arrays "max_angles" and "min_angles" have 6 elements. The question is how to reduce the number of elements in the array "min_angles" from 6 to 3, where I will have only the global minimum and the 2 non-neighbor valleys. The attached pic should help. I am able to find the green circle, but I also need to find the 2 red circles. Note that the global valley (green circle) is not always in the middle. It can be the first element of the array "min_angles", or it can be the last one. In the picture below, it’s number 4. I have a periodic signal with 6 peaks and 6 valleys. I am able to find all 6 peaks and all 6 valleys using the code below:
% plot periodic signal
plot(angle,signal)
hold on;
% fit to avoid noisy oscillations and find 6 global peaks
f = fit(angle,signal,’sin9′);
yfitted = feval(f,angle);
plot(angle,yfitted,’r’)
% find peaks and corresponding angles
[ypk0,idx0] = findpeaks(yfitted);
peaks = signal(idx0);
max_angles = angle(idx0);
% invert fitted signal to find 6 global valleys and corresponding angles
yfittedinv = max(yfitted) – yfitted;
[ypk,idx] = findpeaks(yfittedinv);
valleys = signal(idx);
min_angles = angle(idx);
Furthermore, I am able to find the global minimum (i.e., the lowest valley) using this line:
% find the global minimum
minangle = min_angles(valleys == min(valleys));
Both the arrays "max_angles" and "min_angles" have 6 elements. The question is how to reduce the number of elements in the array "min_angles" from 6 to 3, where I will have only the global minimum and the 2 non-neighbor valleys. The attached pic should help. I am able to find the green circle, but I also need to find the 2 red circles. Note that the global valley (green circle) is not always in the middle. It can be the first element of the array "min_angles", or it can be the last one. In the picture below, it’s number 4. findpeaks, findvalleys MATLAB Answers — New Questions
Unable to Install MatLab via SYSTEM Account
I have been trying to deploy MATLAB R2023b to Windows 10 PC’s in our organization, using remote Powershell scripts which run under SYSTEM credentials. However, the installation always hangs, fairly close to the end. The mathworks_install.log shows the last log as ‘Installing MathWorks Service Host’, which is where it seems to hang indefinitely.
From what I can see, when installing MATLAB in a user context, the Service Host would be installed to C:Users%username%AppDataLocalMathWorksServiceHost. I am guessing that the MATLAB installer has a problem with this when running as SYSTEM. Does anyone have any advice on how we might get around this? As far as I can tell, any user who logs into the PC and opens MATLAB will have the Service Host installed under their profile – so I don’t think it is necessary for this to be done during the initial installation? I would take any suggestion which would allow the installation routine to complete.I have been trying to deploy MATLAB R2023b to Windows 10 PC’s in our organization, using remote Powershell scripts which run under SYSTEM credentials. However, the installation always hangs, fairly close to the end. The mathworks_install.log shows the last log as ‘Installing MathWorks Service Host’, which is where it seems to hang indefinitely.
From what I can see, when installing MATLAB in a user context, the Service Host would be installed to C:Users%username%AppDataLocalMathWorksServiceHost. I am guessing that the MATLAB installer has a problem with this when running as SYSTEM. Does anyone have any advice on how we might get around this? As far as I can tell, any user who logs into the PC and opens MATLAB will have the Service Host installed under their profile – so I don’t think it is necessary for this to be done during the initial installation? I would take any suggestion which would allow the installation routine to complete. I have been trying to deploy MATLAB R2023b to Windows 10 PC’s in our organization, using remote Powershell scripts which run under SYSTEM credentials. However, the installation always hangs, fairly close to the end. The mathworks_install.log shows the last log as ‘Installing MathWorks Service Host’, which is where it seems to hang indefinitely.
From what I can see, when installing MATLAB in a user context, the Service Host would be installed to C:Users%username%AppDataLocalMathWorksServiceHost. I am guessing that the MATLAB installer has a problem with this when running as SYSTEM. Does anyone have any advice on how we might get around this? As far as I can tell, any user who logs into the PC and opens MATLAB will have the Service Host installed under their profile – so I don’t think it is necessary for this to be done during the initial installation? I would take any suggestion which would allow the installation routine to complete. installation, service host, mathworks service host, r2023b MATLAB Answers — New Questions
I am trying to use matlab with refprop, but it shows [SETUP error 101] error in opening file for component # 1; filename = (C:Program Files (x86)REFPROPfluidsfluid.fld).
fluid=’cyclopentane’
T1=348.15;
P1=refpropm(‘P’,’T’,T1,’Q’,1,’fluid’);fluid=’cyclopentane’
T1=348.15;
P1=refpropm(‘P’,’T’,T1,’Q’,1,’fluid’); fluid=’cyclopentane’
T1=348.15;
P1=refpropm(‘P’,’T’,T1,’Q’,1,’fluid’); refprop, [setup error 101] MATLAB Answers — New Questions
How to resolve unsupported functions in MATLAB HDL Coder?
Hello,
We have some simulation code written in MATLAB that we are trying to simulate and deploy on an FPGA, and so we are trying to use the HDL Coder tool for this task. However, we are receiving code generation issues indicating that the following functions are not supported:
diff
fft
exp
angle
ifft
filter
Is there perhaps a toolkit or package that replicates these functions with support for HDL coding? I tried referencing the list of supported functions found here:
https://www.mathworks.com/help/hdlcoder/ug/functions-supported-for-hdl-code-generation-alphabetical-list.html
But the links for supported functions don’t seem to be working (at least for me).
Otherwise, is there a recommended way of resolving this?
Thank you,
James
P.S. I have successfully used the MATLAB Coder to generate C code for this project, if this helps.Hello,
We have some simulation code written in MATLAB that we are trying to simulate and deploy on an FPGA, and so we are trying to use the HDL Coder tool for this task. However, we are receiving code generation issues indicating that the following functions are not supported:
diff
fft
exp
angle
ifft
filter
Is there perhaps a toolkit or package that replicates these functions with support for HDL coding? I tried referencing the list of supported functions found here:
https://www.mathworks.com/help/hdlcoder/ug/functions-supported-for-hdl-code-generation-alphabetical-list.html
But the links for supported functions don’t seem to be working (at least for me).
Otherwise, is there a recommended way of resolving this?
Thank you,
James
P.S. I have successfully used the MATLAB Coder to generate C code for this project, if this helps. Hello,
We have some simulation code written in MATLAB that we are trying to simulate and deploy on an FPGA, and so we are trying to use the HDL Coder tool for this task. However, we are receiving code generation issues indicating that the following functions are not supported:
diff
fft
exp
angle
ifft
filter
Is there perhaps a toolkit or package that replicates these functions with support for HDL coding? I tried referencing the list of supported functions found here:
https://www.mathworks.com/help/hdlcoder/ug/functions-supported-for-hdl-code-generation-alphabetical-list.html
But the links for supported functions don’t seem to be working (at least for me).
Otherwise, is there a recommended way of resolving this?
Thank you,
James
P.S. I have successfully used the MATLAB Coder to generate C code for this project, if this helps. fft, matlab code MATLAB Answers — New Questions
FGETL taking a long time to execute
I am running fgetl in a loop similar to the code below. When profiling the code, I noticed that fgetl(fid) takes the most time to execute compared to the rest of the code. After checking the fgetl documentation, I found the following note in the documentation:
fgetl is intended for use with files that contain newline characters. Given a file with no newline characters, fgetl may take a long time to execute.
However, the documentation does not provide a solution for files without newline characters. Since my file lacks newline characters, what would be the best alternative to fgetl?
fid = fopen(FileName);
while ischar(tline) %loops over 1e5 times
% read new line
tic
tline = fgetl(fid);
toc
% Do stuff with tline
endI am running fgetl in a loop similar to the code below. When profiling the code, I noticed that fgetl(fid) takes the most time to execute compared to the rest of the code. After checking the fgetl documentation, I found the following note in the documentation:
fgetl is intended for use with files that contain newline characters. Given a file with no newline characters, fgetl may take a long time to execute.
However, the documentation does not provide a solution for files without newline characters. Since my file lacks newline characters, what would be the best alternative to fgetl?
fid = fopen(FileName);
while ischar(tline) %loops over 1e5 times
% read new line
tic
tline = fgetl(fid);
toc
% Do stuff with tline
end I am running fgetl in a loop similar to the code below. When profiling the code, I noticed that fgetl(fid) takes the most time to execute compared to the rest of the code. After checking the fgetl documentation, I found the following note in the documentation:
fgetl is intended for use with files that contain newline characters. Given a file with no newline characters, fgetl may take a long time to execute.
However, the documentation does not provide a solution for files without newline characters. Since my file lacks newline characters, what would be the best alternative to fgetl?
fid = fopen(FileName);
while ischar(tline) %loops over 1e5 times
% read new line
tic
tline = fgetl(fid);
toc
% Do stuff with tline
end fgetl, fgets, loop MATLAB Answers — New Questions
Increase the plotting performance in the MATLAB level (drawmode/ optimizing rendering/ down sampling etc)
*Problem statement*: Increase the plotting performance in the MATLAB level (drawmode/ optimizing rendering/ down sampling etc)
*Background*: We are working on a MATLAB based framework for analysis and visualization of data. The information that we use for plotting is very huge. The number of data points are in the range of ~10E7 or more and we are facing MATLAB performance issues when we zoom/pan/maximize/minimize. We urgently need to improve the performance. The requirement is to have the complete information in the plot but the end user chooses to enable or disable particular lines based on the need. As a framework owner we do not have any control on the number of data points that are used for the plot or remove the overlapping points.
Bottom line is we cannot modify the data to be plotted so we will continue to have huge number of points. We can only try from the MATLAB layer to increase the performance as requested above.
Please help us to improve the performance with your experience.
Looking forward for your answers.
Thanks,
Dhanya*Problem statement*: Increase the plotting performance in the MATLAB level (drawmode/ optimizing rendering/ down sampling etc)
*Background*: We are working on a MATLAB based framework for analysis and visualization of data. The information that we use for plotting is very huge. The number of data points are in the range of ~10E7 or more and we are facing MATLAB performance issues when we zoom/pan/maximize/minimize. We urgently need to improve the performance. The requirement is to have the complete information in the plot but the end user chooses to enable or disable particular lines based on the need. As a framework owner we do not have any control on the number of data points that are used for the plot or remove the overlapping points.
Bottom line is we cannot modify the data to be plotted so we will continue to have huge number of points. We can only try from the MATLAB layer to increase the performance as requested above.
Please help us to improve the performance with your experience.
Looking forward for your answers.
Thanks,
Dhanya *Problem statement*: Increase the plotting performance in the MATLAB level (drawmode/ optimizing rendering/ down sampling etc)
*Background*: We are working on a MATLAB based framework for analysis and visualization of data. The information that we use for plotting is very huge. The number of data points are in the range of ~10E7 or more and we are facing MATLAB performance issues when we zoom/pan/maximize/minimize. We urgently need to improve the performance. The requirement is to have the complete information in the plot but the end user chooses to enable or disable particular lines based on the need. As a framework owner we do not have any control on the number of data points that are used for the plot or remove the overlapping points.
Bottom line is we cannot modify the data to be plotted so we will continue to have huge number of points. We can only try from the MATLAB layer to increase the performance as requested above.
Please help us to improve the performance with your experience.
Looking forward for your answers.
Thanks,
Dhanya matlab plot performance, performance, hg1, hg2 MATLAB Answers — New Questions