Tag Archives: matlab
Why do I receive error LNK1104: cannot open file libboost_zlib-vc142-mt-x64-1_84.lib
I receive "error LNK1104: cannot open file libboost_zlib-vc142-mt-x64-1_84.lib" when I run following code
mex -v "D:csvfilehubsfastTableReadV3.cpp" -ID:boost_1_84_0 -LD:boost_1_84_0stagelib
I find the file "libboost_zlib-vc142-mt-x64-1_84.lib" in "D:boost_1_84_0stagelib". I can’t figure out why it still have this error.I receive "error LNK1104: cannot open file libboost_zlib-vc142-mt-x64-1_84.lib" when I run following code
mex -v "D:csvfilehubsfastTableReadV3.cpp" -ID:boost_1_84_0 -LD:boost_1_84_0stagelib
I find the file "libboost_zlib-vc142-mt-x64-1_84.lib" in "D:boost_1_84_0stagelib". I can’t figure out why it still have this error. I receive "error LNK1104: cannot open file libboost_zlib-vc142-mt-x64-1_84.lib" when I run following code
mex -v "D:csvfilehubsfastTableReadV3.cpp" -ID:boost_1_84_0 -LD:boost_1_84_0stagelib
I find the file "libboost_zlib-vc142-mt-x64-1_84.lib" in "D:boost_1_84_0stagelib". I can’t figure out why it still have this error. mex, mex compiler MATLAB Answers — New Questions
Figure in shrunk on screen when dimensions are set for publishing
I want to create a figure of 5 x 5 cm to insert as a panel on a larger figure for academic publishing. I would like to set the fontsize in matlab so that it is consistent across panels (ie. 8). I could for example export the figure with exportgraphics and rescale the figure in an image editor but then, the fontsize ends up being scaled also, which I do not want.
My problem is that if I set the figure dimension to 5×5, its appearance on the screen (4K resolution) becomes very small (spanning around 100 x 100 pixels on screen). I would like to be able to scale the figure displayed on the screen so that the 5 x 5 cm figure spans say 1000 x 1000 pixels (similar as in a pdf which you would open and zoom in).I want to create a figure of 5 x 5 cm to insert as a panel on a larger figure for academic publishing. I would like to set the fontsize in matlab so that it is consistent across panels (ie. 8). I could for example export the figure with exportgraphics and rescale the figure in an image editor but then, the fontsize ends up being scaled also, which I do not want.
My problem is that if I set the figure dimension to 5×5, its appearance on the screen (4K resolution) becomes very small (spanning around 100 x 100 pixels on screen). I would like to be able to scale the figure displayed on the screen so that the 5 x 5 cm figure spans say 1000 x 1000 pixels (similar as in a pdf which you would open and zoom in). I want to create a figure of 5 x 5 cm to insert as a panel on a larger figure for academic publishing. I would like to set the fontsize in matlab so that it is consistent across panels (ie. 8). I could for example export the figure with exportgraphics and rescale the figure in an image editor but then, the fontsize ends up being scaled also, which I do not want.
My problem is that if I set the figure dimension to 5×5, its appearance on the screen (4K resolution) becomes very small (spanning around 100 x 100 pixels on screen). I would like to be able to scale the figure displayed on the screen so that the 5 x 5 cm figure spans say 1000 x 1000 pixels (similar as in a pdf which you would open and zoom in). figure, export MATLAB Answers — New Questions
Creating a 2D Lookup Table for PMSM in EV Applications Using Simulink
Hello MATLAB Simulink Community,
I am currently working on developing a 2D Lookup Table for a Permanent Magnet Synchronous Motor (PMSM) to optimize its operation in an electric vehicle (EV). My objective is to collect data on motor torque, Vde (d-axis voltage), and Vqe (q-axis voltage) under conditions of limited back-EMF WHILE changing Beta-angle and stator Current. This data collection is critical for optimizing motor control strategies(MTPA, Field-Weakening control)
Here are the specific aspects I need help with:
Speed Control Setup: I need to implement a control system in Simulink that allows the PMSM to operate at set speeds to run with limited back-EMF. Which blocks or models would be best for controlling speed of a PMSM regardless of current of PMSM in Simulink?
Data Collection for LUT: As the motor runs, I need to systematically record the torque, Vde, and Vqe. What are the best practices for setting up data logging in Simulink for these variables, especially considering the impacts of limited back-EMF?
Lookup Table Generation: Any advice on how to automate the generation of a 2D LUT based on the collected data within Simulink would be greatly appreciated.
Could you please provide guidance or suggest resources, blocks, or toolkits in Simulink that could be useful for these purposes? Additionally, if there are example models or tutorials related to advanced PMSM control, including speed control and regenerative braking, those would be very helpful.
Thank you in advance for your assistance!Hello MATLAB Simulink Community,
I am currently working on developing a 2D Lookup Table for a Permanent Magnet Synchronous Motor (PMSM) to optimize its operation in an electric vehicle (EV). My objective is to collect data on motor torque, Vde (d-axis voltage), and Vqe (q-axis voltage) under conditions of limited back-EMF WHILE changing Beta-angle and stator Current. This data collection is critical for optimizing motor control strategies(MTPA, Field-Weakening control)
Here are the specific aspects I need help with:
Speed Control Setup: I need to implement a control system in Simulink that allows the PMSM to operate at set speeds to run with limited back-EMF. Which blocks or models would be best for controlling speed of a PMSM regardless of current of PMSM in Simulink?
Data Collection for LUT: As the motor runs, I need to systematically record the torque, Vde, and Vqe. What are the best practices for setting up data logging in Simulink for these variables, especially considering the impacts of limited back-EMF?
Lookup Table Generation: Any advice on how to automate the generation of a 2D LUT based on the collected data within Simulink would be greatly appreciated.
Could you please provide guidance or suggest resources, blocks, or toolkits in Simulink that could be useful for these purposes? Additionally, if there are example models or tutorials related to advanced PMSM control, including speed control and regenerative braking, those would be very helpful.
Thank you in advance for your assistance! Hello MATLAB Simulink Community,
I am currently working on developing a 2D Lookup Table for a Permanent Magnet Synchronous Motor (PMSM) to optimize its operation in an electric vehicle (EV). My objective is to collect data on motor torque, Vde (d-axis voltage), and Vqe (q-axis voltage) under conditions of limited back-EMF WHILE changing Beta-angle and stator Current. This data collection is critical for optimizing motor control strategies(MTPA, Field-Weakening control)
Here are the specific aspects I need help with:
Speed Control Setup: I need to implement a control system in Simulink that allows the PMSM to operate at set speeds to run with limited back-EMF. Which blocks or models would be best for controlling speed of a PMSM regardless of current of PMSM in Simulink?
Data Collection for LUT: As the motor runs, I need to systematically record the torque, Vde, and Vqe. What are the best practices for setting up data logging in Simulink for these variables, especially considering the impacts of limited back-EMF?
Lookup Table Generation: Any advice on how to automate the generation of a 2D LUT based on the collected data within Simulink would be greatly appreciated.
Could you please provide guidance or suggest resources, blocks, or toolkits in Simulink that could be useful for these purposes? Additionally, if there are example models or tutorials related to advanced PMSM control, including speed control and regenerative braking, those would be very helpful.
Thank you in advance for your assistance! mtpa, field weakening, pmsm MATLAB Answers — New Questions
Is there a way to turn a subsystem that exists inside a slx file to its respective time tasks?
Is there a way to turn a subsystem that exists inside a slx file to its respective time tasks?
ex) one of them task is 10ms, other task is 20ms….Is there a way to turn a subsystem that exists inside a slx file to its respective time tasks?
ex) one of them task is 10ms, other task is 20ms…. Is there a way to turn a subsystem that exists inside a slx file to its respective time tasks?
ex) one of them task is 10ms, other task is 20ms…. simulink, matlab MATLAB Answers — New Questions
4 walls vs 1 wall – House regulation on heating
Hi MathWorks team,
While studyin a House Heating system, I failed to understand why would the model of the house only have one wall insted of 4 walls and a floor ? (House Heating System)
I’m trying to model my own model on this theme, that is a room heating system for starters.
The model from MathWorks
The idea of a model I have in mindHi MathWorks team,
While studyin a House Heating system, I failed to understand why would the model of the house only have one wall insted of 4 walls and a floor ? (House Heating System)
I’m trying to model my own model on this theme, that is a room heating system for starters.
The model from MathWorks
The idea of a model I have in mind Hi MathWorks team,
While studyin a House Heating system, I failed to understand why would the model of the house only have one wall insted of 4 walls and a floor ? (House Heating System)
I’m trying to model my own model on this theme, that is a room heating system for starters.
The model from MathWorks
The idea of a model I have in mind house, heating, cooling, thermal control, temperature regulation, simscape, room heating MATLAB Answers — New Questions
Error in sending mail through matlab
Im trying to send a mail through matlab but im keep getting this error
my code was like
mail = ‘myuniversitymail@univ.edu’;
password = ‘mypassword’;
mailingList = {‘receivermail@gmail.com’};
server = ‘smtp-mail.outlook.com’;
props = java.lang.System.getProperties;
props.setProperty(‘mail.smtp.port’,’587′);
props.setProperty(‘mail.smtp.starttls.enable’,’true’);
props.setProperty(‘mail.smtp.ssl.trust’, ‘*’)
setpref(‘Internet’,’E_mail’,mail);
setpref(‘Internet’,’SMTP_Server’,server);
setpref(‘Internet’,’SMTP_Username’,mail);
setpref(‘Internet’,’SMTP_Password’,password);
messageBody = sprintf(‘ Good morning ‘);
messageBody = sprintf(‘%snn Here is the data analysis from yesterdays data. Have a great day!’, messageBody);
messageBody = sprintf(‘%snnn *This email was generated and sent automatically via MATLAB’, messageBody);
sendmail(mailingList,"Data Analysis",messageBody,filename);
And the error is like,
Error using sendmail (line 184)
Can’t send command to SMTP host;
No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
Error in project (line 73)
sendmail(mailingList,"Data Analysis",messageBody,filename);
Pls help me to resolve this issue asap….Im trying to send a mail through matlab but im keep getting this error
my code was like
mail = ‘myuniversitymail@univ.edu’;
password = ‘mypassword’;
mailingList = {‘receivermail@gmail.com’};
server = ‘smtp-mail.outlook.com’;
props = java.lang.System.getProperties;
props.setProperty(‘mail.smtp.port’,’587′);
props.setProperty(‘mail.smtp.starttls.enable’,’true’);
props.setProperty(‘mail.smtp.ssl.trust’, ‘*’)
setpref(‘Internet’,’E_mail’,mail);
setpref(‘Internet’,’SMTP_Server’,server);
setpref(‘Internet’,’SMTP_Username’,mail);
setpref(‘Internet’,’SMTP_Password’,password);
messageBody = sprintf(‘ Good morning ‘);
messageBody = sprintf(‘%snn Here is the data analysis from yesterdays data. Have a great day!’, messageBody);
messageBody = sprintf(‘%snnn *This email was generated and sent automatically via MATLAB’, messageBody);
sendmail(mailingList,"Data Analysis",messageBody,filename);
And the error is like,
Error using sendmail (line 184)
Can’t send command to SMTP host;
No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
Error in project (line 73)
sendmail(mailingList,"Data Analysis",messageBody,filename);
Pls help me to resolve this issue asap…. Im trying to send a mail through matlab but im keep getting this error
my code was like
mail = ‘myuniversitymail@univ.edu’;
password = ‘mypassword’;
mailingList = {‘receivermail@gmail.com’};
server = ‘smtp-mail.outlook.com’;
props = java.lang.System.getProperties;
props.setProperty(‘mail.smtp.port’,’587′);
props.setProperty(‘mail.smtp.starttls.enable’,’true’);
props.setProperty(‘mail.smtp.ssl.trust’, ‘*’)
setpref(‘Internet’,’E_mail’,mail);
setpref(‘Internet’,’SMTP_Server’,server);
setpref(‘Internet’,’SMTP_Username’,mail);
setpref(‘Internet’,’SMTP_Password’,password);
messageBody = sprintf(‘ Good morning ‘);
messageBody = sprintf(‘%snn Here is the data analysis from yesterdays data. Have a great day!’, messageBody);
messageBody = sprintf(‘%snnn *This email was generated and sent automatically via MATLAB’, messageBody);
sendmail(mailingList,"Data Analysis",messageBody,filename);
And the error is like,
Error using sendmail (line 184)
Can’t send command to SMTP host;
No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
Error in project (line 73)
sendmail(mailingList,"Data Analysis",messageBody,filename);
Pls help me to resolve this issue asap…. matlab error, sendmail error, smtp host, sendmail, mail MATLAB Answers — New Questions
different color to plot
hi,it’ possible to plot in different color? (example : line color yellow but the last point are colored in black)hi,it’ possible to plot in different color? (example : line color yellow but the last point are colored in black) hi,it’ possible to plot in different color? (example : line color yellow but the last point are colored in black) different color to plot MATLAB Answers — New Questions
Index exceeds the number of array elements. Index must not exceed 1.
%% Design Project Part 2
% 2.1
% Constants:
kapp = 0.009; % m^3/mol*min
L = 1; % m
Vtot = 0.25; % m^3
FT0 = 20; % mol/ min
v0 = 0.08; % m^3/min
P = 100; % atm
rho = 4.2; % kg/m^3
mu = 0.492*10^-5; % kg/m*s
dp = 0.015; % m
phi = 0.75; % ?
km = 4; % 1/min
Fsg0 = 0.1; % mol/min
% Cases:
vsg0 = 0.1; % m^3/min
%vsg0 = 0.001; % m^3/min
v = @(FA, FB, FR, FP) ((v0/FT0)*(FA+FB+FR+FP));
vsg = @(FPsg) vsg0((Fsg0+FPsg)/Fsg0);
CA = @(FA, FB, FR, FP) FA/v(FA, FB, FR, FP);
CB = @(FA, FB, FR, FP) FB/v(FA, FB, FR, FP);
CP = @(FA, FB, FR, FP) FP/v(FA, FB, FR, FP);
CR = @(FA, FB, FR, FP) FR/v(FA, FB, FR, FP);
CPsg = @(FPsg) FPsg/vsg(FPsg);
dFAdV = @(FA, FB, FR, FP) kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFBdV = @(FA, FB, FR, FP) kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFRdV = @(FA, FB, FR, FP) -kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFPdV = @(FPsg, FA, FB, FP, FR) (-kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP))-km(CP(FA, FB, FR, FP)-CPsg(FPsg));
dFpsgdV = @(FPsg, FP) km(CP-CPsg);
FA = 10; % mol/ min
FB = 10; % mol/ min
FR = 0; % mol/ min
FP = 0; % mol/ min
FPsg = 0.1; % mol/min
dV = 0.01;
Vlim = 0.25;
Vspan = 0:dV:Vlim;
CA_values = zeros(size(Vspan));
CB_values = zeros(size(Vspan));
CP_values = zeros(size(Vspan));
CR_values = zeros(size(Vspan));
CPsg_values = zeros(size(Vspan));
FA_values = zeros(size(Vspan));
FB_values = zeros(size(Vspan));
FR_values = zeros(size(Vspan));
FP_values = zeros(size(Vspan));
FPsg_values = zeros(size(Vspan));
for i=1:length(Vspan)
dFA = dFAdV(FA, FB, FR, FP);
dFB = dFBdV(FA, FB, FR, FP);
dFR = dFRdV(FA, FB, FR, FP);
dFP = dFPdV(FPsg, FA, FB, FP, FR);
dFPsg = dFPsgdV(Fpsg, FP);
CA_values(i) = CA(FA, FB, FR, FP);
CB_values(i) = CB(FA, FB, FR, FP);
CP_values(i) = CP(FA, FB, FR, FP);
CR_values(i) = CR(FA, FB, FR, FP);
CPsg_values(i) = CPsg(Fpsg);
dFA = FA+dFA*dV;
dFB = FB+dFB*dV;
dFR = FR+dFR*dV;
dFP = FP+dFP*dV;
dFPsg = FPsg+dFPsg*dV;
FA_values(i) = FA;
FB_values(i) = FB;
FR_values(i) = FR;
FP_values(i) = FP;
FPsg_values(i) = FPsg;
end
figure()
hold on;
plot(Vspan, FA_values,’LineWidth’, 2);
plot(Vspan, FB_values,’LineWidth’, 2);
plot(Vspan, FP_values,’LineWidth’, 2);
plot(Vspan, FR_values,’LineWidth’, 2);
plot(Vspan, FPsg_values,’LineWidth’, 2);
xlabel(‘PBR volume V [=] m^3’);
ylabel(‘f(V) [=] mol/min’);
set(gca, ‘LineWidth’, 2, ‘FontSize’, 20);
hold off;
Error in Design_Project1>@(FPsg)vsg0((Fsg0+FPsg)/Fsg0) (line 27)
vsg = @(FPsg) vsg0((Fsg0+FPsg)/Fsg0);
Error in Design_Project1>@(FPsg)FPsg/vsg(FPsg) (line 33)
CPsg = @(FPsg) FPsg/vsg(FPsg);
Error in Design_Project1>@(FPsg,FA,FB,FP,FR)(-kapp*CA(FA,FB,FR,FP)*CB(FA,FB,FR,FP))-km(CP(FA,FB,FR,FP)-CPsg(FPsg)) (line 38)
dFPdV = @(FPsg, FA, FB, FP, FR) (-kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP))-km(CP(FA, FB, FR, FP)-CPsg(FPsg));
Error in Design_Project1 (line 68)
dFP = dFPdV(FPsg, FA, FB, FP, FR);%% Design Project Part 2
% 2.1
% Constants:
kapp = 0.009; % m^3/mol*min
L = 1; % m
Vtot = 0.25; % m^3
FT0 = 20; % mol/ min
v0 = 0.08; % m^3/min
P = 100; % atm
rho = 4.2; % kg/m^3
mu = 0.492*10^-5; % kg/m*s
dp = 0.015; % m
phi = 0.75; % ?
km = 4; % 1/min
Fsg0 = 0.1; % mol/min
% Cases:
vsg0 = 0.1; % m^3/min
%vsg0 = 0.001; % m^3/min
v = @(FA, FB, FR, FP) ((v0/FT0)*(FA+FB+FR+FP));
vsg = @(FPsg) vsg0((Fsg0+FPsg)/Fsg0);
CA = @(FA, FB, FR, FP) FA/v(FA, FB, FR, FP);
CB = @(FA, FB, FR, FP) FB/v(FA, FB, FR, FP);
CP = @(FA, FB, FR, FP) FP/v(FA, FB, FR, FP);
CR = @(FA, FB, FR, FP) FR/v(FA, FB, FR, FP);
CPsg = @(FPsg) FPsg/vsg(FPsg);
dFAdV = @(FA, FB, FR, FP) kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFBdV = @(FA, FB, FR, FP) kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFRdV = @(FA, FB, FR, FP) -kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFPdV = @(FPsg, FA, FB, FP, FR) (-kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP))-km(CP(FA, FB, FR, FP)-CPsg(FPsg));
dFpsgdV = @(FPsg, FP) km(CP-CPsg);
FA = 10; % mol/ min
FB = 10; % mol/ min
FR = 0; % mol/ min
FP = 0; % mol/ min
FPsg = 0.1; % mol/min
dV = 0.01;
Vlim = 0.25;
Vspan = 0:dV:Vlim;
CA_values = zeros(size(Vspan));
CB_values = zeros(size(Vspan));
CP_values = zeros(size(Vspan));
CR_values = zeros(size(Vspan));
CPsg_values = zeros(size(Vspan));
FA_values = zeros(size(Vspan));
FB_values = zeros(size(Vspan));
FR_values = zeros(size(Vspan));
FP_values = zeros(size(Vspan));
FPsg_values = zeros(size(Vspan));
for i=1:length(Vspan)
dFA = dFAdV(FA, FB, FR, FP);
dFB = dFBdV(FA, FB, FR, FP);
dFR = dFRdV(FA, FB, FR, FP);
dFP = dFPdV(FPsg, FA, FB, FP, FR);
dFPsg = dFPsgdV(Fpsg, FP);
CA_values(i) = CA(FA, FB, FR, FP);
CB_values(i) = CB(FA, FB, FR, FP);
CP_values(i) = CP(FA, FB, FR, FP);
CR_values(i) = CR(FA, FB, FR, FP);
CPsg_values(i) = CPsg(Fpsg);
dFA = FA+dFA*dV;
dFB = FB+dFB*dV;
dFR = FR+dFR*dV;
dFP = FP+dFP*dV;
dFPsg = FPsg+dFPsg*dV;
FA_values(i) = FA;
FB_values(i) = FB;
FR_values(i) = FR;
FP_values(i) = FP;
FPsg_values(i) = FPsg;
end
figure()
hold on;
plot(Vspan, FA_values,’LineWidth’, 2);
plot(Vspan, FB_values,’LineWidth’, 2);
plot(Vspan, FP_values,’LineWidth’, 2);
plot(Vspan, FR_values,’LineWidth’, 2);
plot(Vspan, FPsg_values,’LineWidth’, 2);
xlabel(‘PBR volume V [=] m^3’);
ylabel(‘f(V) [=] mol/min’);
set(gca, ‘LineWidth’, 2, ‘FontSize’, 20);
hold off;
Error in Design_Project1>@(FPsg)vsg0((Fsg0+FPsg)/Fsg0) (line 27)
vsg = @(FPsg) vsg0((Fsg0+FPsg)/Fsg0);
Error in Design_Project1>@(FPsg)FPsg/vsg(FPsg) (line 33)
CPsg = @(FPsg) FPsg/vsg(FPsg);
Error in Design_Project1>@(FPsg,FA,FB,FP,FR)(-kapp*CA(FA,FB,FR,FP)*CB(FA,FB,FR,FP))-km(CP(FA,FB,FR,FP)-CPsg(FPsg)) (line 38)
dFPdV = @(FPsg, FA, FB, FP, FR) (-kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP))-km(CP(FA, FB, FR, FP)-CPsg(FPsg));
Error in Design_Project1 (line 68)
dFP = dFPdV(FPsg, FA, FB, FP, FR); %% Design Project Part 2
% 2.1
% Constants:
kapp = 0.009; % m^3/mol*min
L = 1; % m
Vtot = 0.25; % m^3
FT0 = 20; % mol/ min
v0 = 0.08; % m^3/min
P = 100; % atm
rho = 4.2; % kg/m^3
mu = 0.492*10^-5; % kg/m*s
dp = 0.015; % m
phi = 0.75; % ?
km = 4; % 1/min
Fsg0 = 0.1; % mol/min
% Cases:
vsg0 = 0.1; % m^3/min
%vsg0 = 0.001; % m^3/min
v = @(FA, FB, FR, FP) ((v0/FT0)*(FA+FB+FR+FP));
vsg = @(FPsg) vsg0((Fsg0+FPsg)/Fsg0);
CA = @(FA, FB, FR, FP) FA/v(FA, FB, FR, FP);
CB = @(FA, FB, FR, FP) FB/v(FA, FB, FR, FP);
CP = @(FA, FB, FR, FP) FP/v(FA, FB, FR, FP);
CR = @(FA, FB, FR, FP) FR/v(FA, FB, FR, FP);
CPsg = @(FPsg) FPsg/vsg(FPsg);
dFAdV = @(FA, FB, FR, FP) kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFBdV = @(FA, FB, FR, FP) kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFRdV = @(FA, FB, FR, FP) -kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP);
dFPdV = @(FPsg, FA, FB, FP, FR) (-kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP))-km(CP(FA, FB, FR, FP)-CPsg(FPsg));
dFpsgdV = @(FPsg, FP) km(CP-CPsg);
FA = 10; % mol/ min
FB = 10; % mol/ min
FR = 0; % mol/ min
FP = 0; % mol/ min
FPsg = 0.1; % mol/min
dV = 0.01;
Vlim = 0.25;
Vspan = 0:dV:Vlim;
CA_values = zeros(size(Vspan));
CB_values = zeros(size(Vspan));
CP_values = zeros(size(Vspan));
CR_values = zeros(size(Vspan));
CPsg_values = zeros(size(Vspan));
FA_values = zeros(size(Vspan));
FB_values = zeros(size(Vspan));
FR_values = zeros(size(Vspan));
FP_values = zeros(size(Vspan));
FPsg_values = zeros(size(Vspan));
for i=1:length(Vspan)
dFA = dFAdV(FA, FB, FR, FP);
dFB = dFBdV(FA, FB, FR, FP);
dFR = dFRdV(FA, FB, FR, FP);
dFP = dFPdV(FPsg, FA, FB, FP, FR);
dFPsg = dFPsgdV(Fpsg, FP);
CA_values(i) = CA(FA, FB, FR, FP);
CB_values(i) = CB(FA, FB, FR, FP);
CP_values(i) = CP(FA, FB, FR, FP);
CR_values(i) = CR(FA, FB, FR, FP);
CPsg_values(i) = CPsg(Fpsg);
dFA = FA+dFA*dV;
dFB = FB+dFB*dV;
dFR = FR+dFR*dV;
dFP = FP+dFP*dV;
dFPsg = FPsg+dFPsg*dV;
FA_values(i) = FA;
FB_values(i) = FB;
FR_values(i) = FR;
FP_values(i) = FP;
FPsg_values(i) = FPsg;
end
figure()
hold on;
plot(Vspan, FA_values,’LineWidth’, 2);
plot(Vspan, FB_values,’LineWidth’, 2);
plot(Vspan, FP_values,’LineWidth’, 2);
plot(Vspan, FR_values,’LineWidth’, 2);
plot(Vspan, FPsg_values,’LineWidth’, 2);
xlabel(‘PBR volume V [=] m^3’);
ylabel(‘f(V) [=] mol/min’);
set(gca, ‘LineWidth’, 2, ‘FontSize’, 20);
hold off;
Error in Design_Project1>@(FPsg)vsg0((Fsg0+FPsg)/Fsg0) (line 27)
vsg = @(FPsg) vsg0((Fsg0+FPsg)/Fsg0);
Error in Design_Project1>@(FPsg)FPsg/vsg(FPsg) (line 33)
CPsg = @(FPsg) FPsg/vsg(FPsg);
Error in Design_Project1>@(FPsg,FA,FB,FP,FR)(-kapp*CA(FA,FB,FR,FP)*CB(FA,FB,FR,FP))-km(CP(FA,FB,FR,FP)-CPsg(FPsg)) (line 38)
dFPdV = @(FPsg, FA, FB, FP, FR) (-kapp*CA(FA, FB, FR, FP)*CB(FA, FB, FR, FP))-km(CP(FA, FB, FR, FP)-CPsg(FPsg));
Error in Design_Project1 (line 68)
dFP = dFPdV(FPsg, FA, FB, FP, FR); ode MATLAB Answers — New Questions
Error with matrix calculation
% matrix calculation
M3 = [0 0 0 0 -1 0 0 0 0 0 1 0;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 -0.05 1;
1 0 0 0 0 0 0 0 -1 0 -1 0;
0 -1 0 0 0 0 0 0 0 -1 0 0;
-0.15 0 0 0 0 0 0 0 -0.15 0 0.05 0;
-1 0 1 0 0 0 0 0 0 0 0 0;
0 1 0 1 0 0 0 0 0 0 0 0;
-0.4*sind(20) -0.4*cosd(20) -0.4*sind(20) 0.4*cosd(20) 0 0 0 0 0 0 0 0;
0 0 0 -1 0 0 0 1 0 0 0 0;
0 0 (BD/2)*cosd(Angle_FBD) (BD/2)*sind(Angle_FBD) 0 0 (BD/2)*cosd(Angle_FBD) (BD/2)*sind(Angle_FBD) 0 0 0 0];
N3 = [mass_body1*Acceleration_G1x;
mass_body1*Acceleration_G1y+mass_body1*9.81;
mass_body1*radius_body1^2*alpha_1;
mass_body2*Acceleration_G2x;
mass_body2*Acceleration_G2y+mass_body2*9.81;
(1/12)*mass_body2*radius_body2^2*alpha_2;
mass_body3*Acceleration_G3x;
mass_body3*Acceleration_G3y+mass_body3*9.81;
(1/12)*mass_body3*radius_body3^2*alpha_3;
mass_body4*Acceleration_G4x;
mass_body4*Acceleration_G4y+mass_body4*9.81;
(1/12)*mass_body4*BD^2*alpha_4];
X = M3/N3
It says that there is an error using "/" and that matrix dimensions must agree. I dont know exactly what this means, and can’t find where the issue is. The error is in the line "X = M3/N3"% matrix calculation
M3 = [0 0 0 0 -1 0 0 0 0 0 1 0;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 -0.05 1;
1 0 0 0 0 0 0 0 -1 0 -1 0;
0 -1 0 0 0 0 0 0 0 -1 0 0;
-0.15 0 0 0 0 0 0 0 -0.15 0 0.05 0;
-1 0 1 0 0 0 0 0 0 0 0 0;
0 1 0 1 0 0 0 0 0 0 0 0;
-0.4*sind(20) -0.4*cosd(20) -0.4*sind(20) 0.4*cosd(20) 0 0 0 0 0 0 0 0;
0 0 0 -1 0 0 0 1 0 0 0 0;
0 0 (BD/2)*cosd(Angle_FBD) (BD/2)*sind(Angle_FBD) 0 0 (BD/2)*cosd(Angle_FBD) (BD/2)*sind(Angle_FBD) 0 0 0 0];
N3 = [mass_body1*Acceleration_G1x;
mass_body1*Acceleration_G1y+mass_body1*9.81;
mass_body1*radius_body1^2*alpha_1;
mass_body2*Acceleration_G2x;
mass_body2*Acceleration_G2y+mass_body2*9.81;
(1/12)*mass_body2*radius_body2^2*alpha_2;
mass_body3*Acceleration_G3x;
mass_body3*Acceleration_G3y+mass_body3*9.81;
(1/12)*mass_body3*radius_body3^2*alpha_3;
mass_body4*Acceleration_G4x;
mass_body4*Acceleration_G4y+mass_body4*9.81;
(1/12)*mass_body4*BD^2*alpha_4];
X = M3/N3
It says that there is an error using "/" and that matrix dimensions must agree. I dont know exactly what this means, and can’t find where the issue is. The error is in the line "X = M3/N3" % matrix calculation
M3 = [0 0 0 0 -1 0 0 0 0 0 1 0;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 -0.05 1;
1 0 0 0 0 0 0 0 -1 0 -1 0;
0 -1 0 0 0 0 0 0 0 -1 0 0;
-0.15 0 0 0 0 0 0 0 -0.15 0 0.05 0;
-1 0 1 0 0 0 0 0 0 0 0 0;
0 1 0 1 0 0 0 0 0 0 0 0;
-0.4*sind(20) -0.4*cosd(20) -0.4*sind(20) 0.4*cosd(20) 0 0 0 0 0 0 0 0;
0 0 0 -1 0 0 0 1 0 0 0 0;
0 0 (BD/2)*cosd(Angle_FBD) (BD/2)*sind(Angle_FBD) 0 0 (BD/2)*cosd(Angle_FBD) (BD/2)*sind(Angle_FBD) 0 0 0 0];
N3 = [mass_body1*Acceleration_G1x;
mass_body1*Acceleration_G1y+mass_body1*9.81;
mass_body1*radius_body1^2*alpha_1;
mass_body2*Acceleration_G2x;
mass_body2*Acceleration_G2y+mass_body2*9.81;
(1/12)*mass_body2*radius_body2^2*alpha_2;
mass_body3*Acceleration_G3x;
mass_body3*Acceleration_G3y+mass_body3*9.81;
(1/12)*mass_body3*radius_body3^2*alpha_3;
mass_body4*Acceleration_G4x;
mass_body4*Acceleration_G4y+mass_body4*9.81;
(1/12)*mass_body4*BD^2*alpha_4];
X = M3/N3
It says that there is an error using "/" and that matrix dimensions must agree. I dont know exactly what this means, and can’t find where the issue is. The error is in the line "X = M3/N3" matrix MATLAB Answers — New Questions
Simulink Discrete Filter Sample Time
Hello everybody I’m new here and new to simulink.
I have a problem
The Sample Time was "canceld" for the discrete Filter in the update 2023b.
At least the easy Set Up trough the Block Parameter, but I need it to initiated for the Task In Simu Link Fundamentals at step 4.5.
Does anyone know what i can do know? that would made my day.
Thank you
Best Regards
JanHello everybody I’m new here and new to simulink.
I have a problem
The Sample Time was "canceld" for the discrete Filter in the update 2023b.
At least the easy Set Up trough the Block Parameter, but I need it to initiated for the Task In Simu Link Fundamentals at step 4.5.
Does anyone know what i can do know? that would made my day.
Thank you
Best Regards
Jan Hello everybody I’m new here and new to simulink.
I have a problem
The Sample Time was "canceld" for the discrete Filter in the update 2023b.
At least the easy Set Up trough the Block Parameter, but I need it to initiated for the Task In Simu Link Fundamentals at step 4.5.
Does anyone know what i can do know? that would made my day.
Thank you
Best Regards
Jan #simulink, #fundamentals MATLAB Answers — New Questions
Ellipsoid Mask based on user input of dimension and euler angle
Actually I am trying to generate a 3d ellipsoid mask based on the user input of semi axes and euler angles. But in my code to do this I am calculating the distance of each pixel from the centre of the ellipse and then based on the ellipse equation pixels falling inside this ellipse are assigned true values. But the problem is that this operation is very tedious as I am scanning each and every pixel.
Any other way to do this which reduces the time complexity of this problem.
function y = mask_3D(a_axis, b_axis, c_axis, psi1, psi2, phi)
if a > b
diameter = 2 * a;
else
diameter = 2 * b;
end
if 2 * c > diameter
diameter = 2 * c;
end
if mod(diameter, round(diameter)) ~= 0
diameter = ceil(diameter);
end
radius = diameter / 2;
if mod(radius, round(radius)) ~= 0
diameter = diameter + 1;
radius = diameter / 2;
end
dist = 2 * ones(diameter + 1, diameter + 1, diameter + 1);
center = 1 + radius;
% Calculate the rotation matrix for the ellipse based on the Euler angles
rotation_matrix = zeros(3);
rotation_matrix(1, 1) = cos(psi1) * cos(psi2) – sin(psi1) * sin(psi2) * cos(phi);
rotation_matrix(2, 1) = -cos(psi1) * sin(psi2) – sin(psi1) * cos(psi2) * cos(phi);
rotation_matrix(3, 1) = sin(psi1) * sin(phi);
rotation_matrix(1, 2) = sin(psi1) * cos(psi2) + cos(psi1) * sin(psi2) * cos(phi);
rotation_matrix(2, 2) = -sin(psi1) * sin(psi2) + cos(psi1) * cos(psi2) * cos(phi);
rotation_matrix(3, 2) = -cos(psi1) * sin(phi);
rotation_matrix(1, 3) = sin(psi2) * sin(phi);
rotation_matrix(2, 3) = cos(psi2) * sin(phi);
rotation_matrix(3, 3) = cos(phi);
k = center – 1;
i_start = 1; i_end = diameter + 1;
j_start = 1; j_end = diameter + 1;
while k < diameter + 1
k = k + 1;
% Loop over all the pixels in the first plane to find
% the pixels belonging to the ellipse
for i = i_start:i_end
for j = j_start:j_end
a1 = [i – center, j – center, k – center];
a2 = [a^2, b^2, c^2];
c1 = a1 * rotation_matrix;
c2 = c1.^2 ./ a2;
dist(i, j, k) = sum(c2);
end
end
if sum(sum(dist(:,:,k) <= 1)) == 0
k = diameter + 1;
end
if k ~= center && k ~= diameter + 1
d = dist(:,:,k – 1) <= 1;
e = dist(:,:,k) <= 1;
d1 = diff(sum(d, 1) ~= 0);
dmin = find(d1 == 1);
dmax = find(d1 == -1);
if size(dmin, 2) > 1
dmin = dmin(1);
dmax = dmax(2);
end
e1 = diff(sum(e, 1) ~= 0);
emin = find(e1 == 1);
emax = find(e1 == -1);
if size(emin, 2) > 1
emin = emin(1);
emax = emax(2);
end
if dmin – emin < 0
j_start = emin – 1;
j_end = j_start + 3 + (dmax – dmin);
if j_end > diameter + 1
j_end = diameter + 1;
end
end
if dmax – emax > 0
j_end = emax + 1;
j_start = j_end – 3 – (dmax – dmin);
if j_start < 1
j_start = 1;
end
end
d1 = diff(sum(d, 2) ~= 0);
dmin = find(d1 == 1);
dmax = find(d1 == -1);
if size(dmin, 1) > 1
dmin = dmin(1);
dmax = dmax(2);
end
e1 = diff(sum(e, 2) ~= 0);
emin = find(e1 == 1);
emax = find(e1 == -1);
if size(emin, 1) > 1
emin = emin(1);
emax = emax(2);
end
if dmin – emin < 0
i_start = emin – 1;
i_end = i_start + 3 + (dmax – dmin);
if i_end > diameter + 1
i_end = diameter + 1;
end
end
if dmax – emax > 0
i_end = emax + 1;
i_start = i_end – 3 – (dmax – dmin);
if i_start < 1
i_start = 1;
end
end
end
end
% Generate whole ellipse
y = dist <= 1;
x = y(1:diameter + 1, 1:diameter + 1, center + 1:diameter + 1);
x1 = zeros(diameter + 1, diameter + 1, center – 1);
for i = 1:size(x, 3)
x1(:,:,size(x, 3) – i + 1) = flipud(fliplr(x(:,:,i)));
end
y(1:diameter + 1, 1:diameter + 1, 1:center – 1) = x1;
endActually I am trying to generate a 3d ellipsoid mask based on the user input of semi axes and euler angles. But in my code to do this I am calculating the distance of each pixel from the centre of the ellipse and then based on the ellipse equation pixels falling inside this ellipse are assigned true values. But the problem is that this operation is very tedious as I am scanning each and every pixel.
Any other way to do this which reduces the time complexity of this problem.
function y = mask_3D(a_axis, b_axis, c_axis, psi1, psi2, phi)
if a > b
diameter = 2 * a;
else
diameter = 2 * b;
end
if 2 * c > diameter
diameter = 2 * c;
end
if mod(diameter, round(diameter)) ~= 0
diameter = ceil(diameter);
end
radius = diameter / 2;
if mod(radius, round(radius)) ~= 0
diameter = diameter + 1;
radius = diameter / 2;
end
dist = 2 * ones(diameter + 1, diameter + 1, diameter + 1);
center = 1 + radius;
% Calculate the rotation matrix for the ellipse based on the Euler angles
rotation_matrix = zeros(3);
rotation_matrix(1, 1) = cos(psi1) * cos(psi2) – sin(psi1) * sin(psi2) * cos(phi);
rotation_matrix(2, 1) = -cos(psi1) * sin(psi2) – sin(psi1) * cos(psi2) * cos(phi);
rotation_matrix(3, 1) = sin(psi1) * sin(phi);
rotation_matrix(1, 2) = sin(psi1) * cos(psi2) + cos(psi1) * sin(psi2) * cos(phi);
rotation_matrix(2, 2) = -sin(psi1) * sin(psi2) + cos(psi1) * cos(psi2) * cos(phi);
rotation_matrix(3, 2) = -cos(psi1) * sin(phi);
rotation_matrix(1, 3) = sin(psi2) * sin(phi);
rotation_matrix(2, 3) = cos(psi2) * sin(phi);
rotation_matrix(3, 3) = cos(phi);
k = center – 1;
i_start = 1; i_end = diameter + 1;
j_start = 1; j_end = diameter + 1;
while k < diameter + 1
k = k + 1;
% Loop over all the pixels in the first plane to find
% the pixels belonging to the ellipse
for i = i_start:i_end
for j = j_start:j_end
a1 = [i – center, j – center, k – center];
a2 = [a^2, b^2, c^2];
c1 = a1 * rotation_matrix;
c2 = c1.^2 ./ a2;
dist(i, j, k) = sum(c2);
end
end
if sum(sum(dist(:,:,k) <= 1)) == 0
k = diameter + 1;
end
if k ~= center && k ~= diameter + 1
d = dist(:,:,k – 1) <= 1;
e = dist(:,:,k) <= 1;
d1 = diff(sum(d, 1) ~= 0);
dmin = find(d1 == 1);
dmax = find(d1 == -1);
if size(dmin, 2) > 1
dmin = dmin(1);
dmax = dmax(2);
end
e1 = diff(sum(e, 1) ~= 0);
emin = find(e1 == 1);
emax = find(e1 == -1);
if size(emin, 2) > 1
emin = emin(1);
emax = emax(2);
end
if dmin – emin < 0
j_start = emin – 1;
j_end = j_start + 3 + (dmax – dmin);
if j_end > diameter + 1
j_end = diameter + 1;
end
end
if dmax – emax > 0
j_end = emax + 1;
j_start = j_end – 3 – (dmax – dmin);
if j_start < 1
j_start = 1;
end
end
d1 = diff(sum(d, 2) ~= 0);
dmin = find(d1 == 1);
dmax = find(d1 == -1);
if size(dmin, 1) > 1
dmin = dmin(1);
dmax = dmax(2);
end
e1 = diff(sum(e, 2) ~= 0);
emin = find(e1 == 1);
emax = find(e1 == -1);
if size(emin, 1) > 1
emin = emin(1);
emax = emax(2);
end
if dmin – emin < 0
i_start = emin – 1;
i_end = i_start + 3 + (dmax – dmin);
if i_end > diameter + 1
i_end = diameter + 1;
end
end
if dmax – emax > 0
i_end = emax + 1;
i_start = i_end – 3 – (dmax – dmin);
if i_start < 1
i_start = 1;
end
end
end
end
% Generate whole ellipse
y = dist <= 1;
x = y(1:diameter + 1, 1:diameter + 1, center + 1:diameter + 1);
x1 = zeros(diameter + 1, diameter + 1, center – 1);
for i = 1:size(x, 3)
x1(:,:,size(x, 3) – i + 1) = flipud(fliplr(x(:,:,i)));
end
y(1:diameter + 1, 1:diameter + 1, 1:center – 1) = x1;
end Actually I am trying to generate a 3d ellipsoid mask based on the user input of semi axes and euler angles. But in my code to do this I am calculating the distance of each pixel from the centre of the ellipse and then based on the ellipse equation pixels falling inside this ellipse are assigned true values. But the problem is that this operation is very tedious as I am scanning each and every pixel.
Any other way to do this which reduces the time complexity of this problem.
function y = mask_3D(a_axis, b_axis, c_axis, psi1, psi2, phi)
if a > b
diameter = 2 * a;
else
diameter = 2 * b;
end
if 2 * c > diameter
diameter = 2 * c;
end
if mod(diameter, round(diameter)) ~= 0
diameter = ceil(diameter);
end
radius = diameter / 2;
if mod(radius, round(radius)) ~= 0
diameter = diameter + 1;
radius = diameter / 2;
end
dist = 2 * ones(diameter + 1, diameter + 1, diameter + 1);
center = 1 + radius;
% Calculate the rotation matrix for the ellipse based on the Euler angles
rotation_matrix = zeros(3);
rotation_matrix(1, 1) = cos(psi1) * cos(psi2) – sin(psi1) * sin(psi2) * cos(phi);
rotation_matrix(2, 1) = -cos(psi1) * sin(psi2) – sin(psi1) * cos(psi2) * cos(phi);
rotation_matrix(3, 1) = sin(psi1) * sin(phi);
rotation_matrix(1, 2) = sin(psi1) * cos(psi2) + cos(psi1) * sin(psi2) * cos(phi);
rotation_matrix(2, 2) = -sin(psi1) * sin(psi2) + cos(psi1) * cos(psi2) * cos(phi);
rotation_matrix(3, 2) = -cos(psi1) * sin(phi);
rotation_matrix(1, 3) = sin(psi2) * sin(phi);
rotation_matrix(2, 3) = cos(psi2) * sin(phi);
rotation_matrix(3, 3) = cos(phi);
k = center – 1;
i_start = 1; i_end = diameter + 1;
j_start = 1; j_end = diameter + 1;
while k < diameter + 1
k = k + 1;
% Loop over all the pixels in the first plane to find
% the pixels belonging to the ellipse
for i = i_start:i_end
for j = j_start:j_end
a1 = [i – center, j – center, k – center];
a2 = [a^2, b^2, c^2];
c1 = a1 * rotation_matrix;
c2 = c1.^2 ./ a2;
dist(i, j, k) = sum(c2);
end
end
if sum(sum(dist(:,:,k) <= 1)) == 0
k = diameter + 1;
end
if k ~= center && k ~= diameter + 1
d = dist(:,:,k – 1) <= 1;
e = dist(:,:,k) <= 1;
d1 = diff(sum(d, 1) ~= 0);
dmin = find(d1 == 1);
dmax = find(d1 == -1);
if size(dmin, 2) > 1
dmin = dmin(1);
dmax = dmax(2);
end
e1 = diff(sum(e, 1) ~= 0);
emin = find(e1 == 1);
emax = find(e1 == -1);
if size(emin, 2) > 1
emin = emin(1);
emax = emax(2);
end
if dmin – emin < 0
j_start = emin – 1;
j_end = j_start + 3 + (dmax – dmin);
if j_end > diameter + 1
j_end = diameter + 1;
end
end
if dmax – emax > 0
j_end = emax + 1;
j_start = j_end – 3 – (dmax – dmin);
if j_start < 1
j_start = 1;
end
end
d1 = diff(sum(d, 2) ~= 0);
dmin = find(d1 == 1);
dmax = find(d1 == -1);
if size(dmin, 1) > 1
dmin = dmin(1);
dmax = dmax(2);
end
e1 = diff(sum(e, 2) ~= 0);
emin = find(e1 == 1);
emax = find(e1 == -1);
if size(emin, 1) > 1
emin = emin(1);
emax = emax(2);
end
if dmin – emin < 0
i_start = emin – 1;
i_end = i_start + 3 + (dmax – dmin);
if i_end > diameter + 1
i_end = diameter + 1;
end
end
if dmax – emax > 0
i_end = emax + 1;
i_start = i_end – 3 – (dmax – dmin);
if i_start < 1
i_start = 1;
end
end
end
end
% Generate whole ellipse
y = dist <= 1;
x = y(1:diameter + 1, 1:diameter + 1, center + 1:diameter + 1);
x1 = zeros(diameter + 1, diameter + 1, center – 1);
for i = 1:size(x, 3)
x1(:,:,size(x, 3) – i + 1) = flipud(fliplr(x(:,:,i)));
end
y(1:diameter + 1, 1:diameter + 1, 1:center – 1) = x1;
end image processing, mathematics, matrix array, optimization, binary MATLAB Answers — New Questions
Estimation of particle size in the image
Hi,
I am trying to estimate size of the particle in the attached image. As this image has both the particles and other shapes, hence, it is bit difficult to estimate the size of the particle alone. Could someone help with this?Hi,
I am trying to estimate size of the particle in the attached image. As this image has both the particles and other shapes, hence, it is bit difficult to estimate the size of the particle alone. Could someone help with this? Hi,
I am trying to estimate size of the particle in the attached image. As this image has both the particles and other shapes, hence, it is bit difficult to estimate the size of the particle alone. Could someone help with this? image processing, image segmentation, image thresold, binary image, particle size, image analysis MATLAB Answers — New Questions
Error in Hierarchical Risk Parity Portfolio
i followed code provided on MATLAB help section under finance/create hierarchical risk parity portfolio and I get this error ‘Unrecognized function or variable ‘getLeafNodesInGroup’. PLease advise on what can solve thisi followed code provided on MATLAB help section under finance/create hierarchical risk parity portfolio and I get this error ‘Unrecognized function or variable ‘getLeafNodesInGroup’. PLease advise on what can solve this i followed code provided on MATLAB help section under finance/create hierarchical risk parity portfolio and I get this error ‘Unrecognized function or variable ‘getLeafNodesInGroup’. PLease advise on what can solve this getleafnodesingroup, hierarchical risk parity MATLAB Answers — New Questions
How to change frequency range doubling of Complex-valued Chirp Signal Spectrogram to match the Real-Valued Chirp Spectrogram
When real-valued linear chirp is plotted in spectrogram, the frequency range is limited to the Nyquist rate frequency range.
However, when complex-valued linar chirp with the same parameters is plotted, the frequency range of the spectrogram doubles. Is there an option to limit the frequeny range to the Nyquist rate?
%%%% Sample Code %%%%
Fs=2E3; %sampling rate
f0=0; %initial frequency offset = 0
f1=0.5E3; %LFM sweeping frequency
t1=0.5;
t=0:1/Fs:t1;
%
%Real Valued Chirp
%
yr=chirp(t,f0,t1,f1,’real’);
figure
spectrogram(yr,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Real in Time-Freq ‘)
%
%Complex Valued Chirp
%
yc=chirp(t,f0,t1,f1,’complex’);
figure
spectrogram(yc,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Complex in Time-Freq ‘)When real-valued linear chirp is plotted in spectrogram, the frequency range is limited to the Nyquist rate frequency range.
However, when complex-valued linar chirp with the same parameters is plotted, the frequency range of the spectrogram doubles. Is there an option to limit the frequeny range to the Nyquist rate?
%%%% Sample Code %%%%
Fs=2E3; %sampling rate
f0=0; %initial frequency offset = 0
f1=0.5E3; %LFM sweeping frequency
t1=0.5;
t=0:1/Fs:t1;
%
%Real Valued Chirp
%
yr=chirp(t,f0,t1,f1,’real’);
figure
spectrogram(yr,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Real in Time-Freq ‘)
%
%Complex Valued Chirp
%
yc=chirp(t,f0,t1,f1,’complex’);
figure
spectrogram(yc,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Complex in Time-Freq ‘) When real-valued linear chirp is plotted in spectrogram, the frequency range is limited to the Nyquist rate frequency range.
However, when complex-valued linar chirp with the same parameters is plotted, the frequency range of the spectrogram doubles. Is there an option to limit the frequeny range to the Nyquist rate?
%%%% Sample Code %%%%
Fs=2E3; %sampling rate
f0=0; %initial frequency offset = 0
f1=0.5E3; %LFM sweeping frequency
t1=0.5;
t=0:1/Fs:t1;
%
%Real Valued Chirp
%
yr=chirp(t,f0,t1,f1,’real’);
figure
spectrogram(yr,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Real in Time-Freq ‘)
%
%Complex Valued Chirp
%
yc=chirp(t,f0,t1,f1,’complex’);
figure
spectrogram(yc,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Complex in Time-Freq ‘) chirp spread spectrum, matlab, spectrogram MATLAB Answers — New Questions
How to fix conjugated chirp signal frequency shift in spectrogram
When a complex-valued linear chirp signal is converted to its conjugate, the frequency shifts to the maximum sampling rate beyond the Nyqust rate. This does not happen in real-valued linear chirp. Is there an option to limit the frequency shift?
Fs=2E3;
f0=0;
f1=0.5E3;
t1=0.5;
t=0:1/Fs:t1;
yc=chirp(t,f0,t1,f1,’complex’);
figure
spectrogram(yc,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Complex in Time-Freq ‘)
%Plot Conjugate chirp
conj_yc=conj(yc);
figure
spectrogram(conj_yc,[],256,512,Fs,’yaxis’);
title(‘Conjugate-UP Chirp-Complex in Time-Freq ‘)When a complex-valued linear chirp signal is converted to its conjugate, the frequency shifts to the maximum sampling rate beyond the Nyqust rate. This does not happen in real-valued linear chirp. Is there an option to limit the frequency shift?
Fs=2E3;
f0=0;
f1=0.5E3;
t1=0.5;
t=0:1/Fs:t1;
yc=chirp(t,f0,t1,f1,’complex’);
figure
spectrogram(yc,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Complex in Time-Freq ‘)
%Plot Conjugate chirp
conj_yc=conj(yc);
figure
spectrogram(conj_yc,[],256,512,Fs,’yaxis’);
title(‘Conjugate-UP Chirp-Complex in Time-Freq ‘) When a complex-valued linear chirp signal is converted to its conjugate, the frequency shifts to the maximum sampling rate beyond the Nyqust rate. This does not happen in real-valued linear chirp. Is there an option to limit the frequency shift?
Fs=2E3;
f0=0;
f1=0.5E3;
t1=0.5;
t=0:1/Fs:t1;
yc=chirp(t,f0,t1,f1,’complex’);
figure
spectrogram(yc,[],256,512,Fs,’yaxis’);
title(‘UP Chirp-Complex in Time-Freq ‘)
%Plot Conjugate chirp
conj_yc=conj(yc);
figure
spectrogram(conj_yc,[],256,512,Fs,’yaxis’);
title(‘Conjugate-UP Chirp-Complex in Time-Freq ‘) chirp, lfm, matlab, spectrogram MATLAB Answers — New Questions
License manager error -15
I am using AppsAnywhere to launch Matlab through my University system. It gives me License manager error -15.
Unfortunatley, I removed the directory where Matlab was prevsiouly installed. I don’t know what to do.I am using AppsAnywhere to launch Matlab through my University system. It gives me License manager error -15.
Unfortunatley, I removed the directory where Matlab was prevsiouly installed. I don’t know what to do. I am using AppsAnywhere to launch Matlab through my University system. It gives me License manager error -15.
Unfortunatley, I removed the directory where Matlab was prevsiouly installed. I don’t know what to do. license manager error -15 MATLAB Answers — New Questions
I need to code a pipe network and solve for flow rates and ideal pump head. I have the basis of a code using fsolve with my equations and unkowns, but keep exceeding iteration
function Mary_H_Kennedy_Fluids_Project
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pipe Flow Project
% Mary Helen Kennedy
% ME 3834 — Fluid Mechanics
% Spring 2024
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Q1 = 4.456; %ft3/s
v1 = 22.69; %ft/s
L = 100; %ft
D = 0.5; %ft
e = 0.00085; %ft
rho = 62; %lbm/ft^3
f = 0.0023; %Initial guess
mu = 2.05*10^-5;
Re = (rho*v1*D)/mu;
A = 0.196;
% Define the function
fun = @(F) [
(F(2)/(rho*9.81)) – (F(1)) + ((v1^2)/(2*9.81)*(f*(L/D)-1)); % Equation for Pipe 1
F(2) – (rho*9.81)*(f*(L/D)*(F(5)^2)/(2*9.81*A^2)); % Equation for Pipe 2
F(2) – (rho*9.81)*(f*(L/D)*(F(5)^2)/(2*9.81*A^2)); % Equation for Pipe 3
(F(2) – F(4)) – (rho*9.81)*(f*(L/D)*(F(6)^2)/(2*9.81*A^2)); % Equation for Pipe 4
F(4) – (rho*9.81)*(f*(L/D)*(F(7)^2)/(2*9.81*A^2)); % Equation for Pipe 5
F(4) – (rho*9.81)*(f*(L/D)*(F(8)^2)/(2*9.81*A^2)); % Equation for Pipe 6
F(5) + F(5) + F(6) – Q1; % Node A
F(6) – F(7) – F(8); % Node B
];
% Initial guess for unknowns
x0 = [2000, 500, 0.0023, 400, 24, 25, 26, 27];
% Call fsolve to solve the system of equations
options = optimoptions(‘fsolve’,’MaxFunctionEvaluations’,10000); % Adjust the maximum number of function evaluations
% Call fsolve with options
F = fsolve(fun, x0, options);
% Unknowns from fsolve
hl = F(1);
Pa = F(2);
f = F(3);
Pb = F(4);
Q3 = F(5);
Q4 = F(6);
Q5 = F(7);
Q6 = F(8);
endfunction Mary_H_Kennedy_Fluids_Project
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pipe Flow Project
% Mary Helen Kennedy
% ME 3834 — Fluid Mechanics
% Spring 2024
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Q1 = 4.456; %ft3/s
v1 = 22.69; %ft/s
L = 100; %ft
D = 0.5; %ft
e = 0.00085; %ft
rho = 62; %lbm/ft^3
f = 0.0023; %Initial guess
mu = 2.05*10^-5;
Re = (rho*v1*D)/mu;
A = 0.196;
% Define the function
fun = @(F) [
(F(2)/(rho*9.81)) – (F(1)) + ((v1^2)/(2*9.81)*(f*(L/D)-1)); % Equation for Pipe 1
F(2) – (rho*9.81)*(f*(L/D)*(F(5)^2)/(2*9.81*A^2)); % Equation for Pipe 2
F(2) – (rho*9.81)*(f*(L/D)*(F(5)^2)/(2*9.81*A^2)); % Equation for Pipe 3
(F(2) – F(4)) – (rho*9.81)*(f*(L/D)*(F(6)^2)/(2*9.81*A^2)); % Equation for Pipe 4
F(4) – (rho*9.81)*(f*(L/D)*(F(7)^2)/(2*9.81*A^2)); % Equation for Pipe 5
F(4) – (rho*9.81)*(f*(L/D)*(F(8)^2)/(2*9.81*A^2)); % Equation for Pipe 6
F(5) + F(5) + F(6) – Q1; % Node A
F(6) – F(7) – F(8); % Node B
];
% Initial guess for unknowns
x0 = [2000, 500, 0.0023, 400, 24, 25, 26, 27];
% Call fsolve to solve the system of equations
options = optimoptions(‘fsolve’,’MaxFunctionEvaluations’,10000); % Adjust the maximum number of function evaluations
% Call fsolve with options
F = fsolve(fun, x0, options);
% Unknowns from fsolve
hl = F(1);
Pa = F(2);
f = F(3);
Pb = F(4);
Q3 = F(5);
Q4 = F(6);
Q5 = F(7);
Q6 = F(8);
end function Mary_H_Kennedy_Fluids_Project
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pipe Flow Project
% Mary Helen Kennedy
% ME 3834 — Fluid Mechanics
% Spring 2024
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Q1 = 4.456; %ft3/s
v1 = 22.69; %ft/s
L = 100; %ft
D = 0.5; %ft
e = 0.00085; %ft
rho = 62; %lbm/ft^3
f = 0.0023; %Initial guess
mu = 2.05*10^-5;
Re = (rho*v1*D)/mu;
A = 0.196;
% Define the function
fun = @(F) [
(F(2)/(rho*9.81)) – (F(1)) + ((v1^2)/(2*9.81)*(f*(L/D)-1)); % Equation for Pipe 1
F(2) – (rho*9.81)*(f*(L/D)*(F(5)^2)/(2*9.81*A^2)); % Equation for Pipe 2
F(2) – (rho*9.81)*(f*(L/D)*(F(5)^2)/(2*9.81*A^2)); % Equation for Pipe 3
(F(2) – F(4)) – (rho*9.81)*(f*(L/D)*(F(6)^2)/(2*9.81*A^2)); % Equation for Pipe 4
F(4) – (rho*9.81)*(f*(L/D)*(F(7)^2)/(2*9.81*A^2)); % Equation for Pipe 5
F(4) – (rho*9.81)*(f*(L/D)*(F(8)^2)/(2*9.81*A^2)); % Equation for Pipe 6
F(5) + F(5) + F(6) – Q1; % Node A
F(6) – F(7) – F(8); % Node B
];
% Initial guess for unknowns
x0 = [2000, 500, 0.0023, 400, 24, 25, 26, 27];
% Call fsolve to solve the system of equations
options = optimoptions(‘fsolve’,’MaxFunctionEvaluations’,10000); % Adjust the maximum number of function evaluations
% Call fsolve with options
F = fsolve(fun, x0, options);
% Unknowns from fsolve
hl = F(1);
Pa = F(2);
f = F(3);
Pb = F(4);
Q3 = F(5);
Q4 = F(6);
Q5 = F(7);
Q6 = F(8);
end fsolve, fluids, help, iterations MATLAB Answers — New Questions
Find a smaller matrix within a larger matrix
I have two matrices with different sizes and I need to find the lower matrix inside the higher matrix.
Example
– Lower Matrix (Unique [1×7])
[ 2 3 4 5 6 7]
– Higher Matrix (Several results [1000×15])
[ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] OK
[ 2 3 4 5 6 7 10 12 13 15 16 19 20 22 23] OK
[ 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17] NOK
. . .
If the 7 numbers from lower matrix matches inside some row from 15 numbers higher matrix, store the result from higher matrix.
It should analyze each row from higher matrix.I have two matrices with different sizes and I need to find the lower matrix inside the higher matrix.
Example
– Lower Matrix (Unique [1×7])
[ 2 3 4 5 6 7]
– Higher Matrix (Several results [1000×15])
[ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] OK
[ 2 3 4 5 6 7 10 12 13 15 16 19 20 22 23] OK
[ 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17] NOK
. . .
If the 7 numbers from lower matrix matches inside some row from 15 numbers higher matrix, store the result from higher matrix.
It should analyze each row from higher matrix. I have two matrices with different sizes and I need to find the lower matrix inside the higher matrix.
Example
– Lower Matrix (Unique [1×7])
[ 2 3 4 5 6 7]
– Higher Matrix (Several results [1000×15])
[ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] OK
[ 2 3 4 5 6 7 10 12 13 15 16 19 20 22 23] OK
[ 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17] NOK
. . .
If the 7 numbers from lower matrix matches inside some row from 15 numbers higher matrix, store the result from higher matrix.
It should analyze each row from higher matrix. contains, matrix array MATLAB Answers — New Questions
why is NaN not of ‘NaN type’ in Simulink?
Hi everyone,
Please, could anyone explain why the constant block NaN is not of type NaN?
Thank you in advance!
Best regards,
NicolasHi everyone,
Please, could anyone explain why the constant block NaN is not of type NaN?
Thank you in advance!
Best regards,
Nicolas Hi everyone,
Please, could anyone explain why the constant block NaN is not of type NaN?
Thank you in advance!
Best regards,
Nicolas simulink, nan MATLAB Answers — New Questions
How to use operations in for loop problems
For values of 1 to 60, create a for-loop that does the following. If the value is 1 to 20, have
the operation be number2, if the value is 21 to 40, have the operation be number, and if the
value is 41 to 60, have the operation be √number. Store all 60 results in 3 different variables
that start at 1. With the results, create a 3×20 matrix where the first row is the results of the
first operation, the second row being the results of the second operation, and the final row
being the results of the final operationFor values of 1 to 60, create a for-loop that does the following. If the value is 1 to 20, have
the operation be number2, if the value is 21 to 40, have the operation be number, and if the
value is 41 to 60, have the operation be √number. Store all 60 results in 3 different variables
that start at 1. With the results, create a 3×20 matrix where the first row is the results of the
first operation, the second row being the results of the second operation, and the final row
being the results of the final operation For values of 1 to 60, create a for-loop that does the following. If the value is 1 to 20, have
the operation be number2, if the value is 21 to 40, have the operation be number, and if the
value is 41 to 60, have the operation be √number. Store all 60 results in 3 different variables
that start at 1. With the results, create a 3×20 matrix where the first row is the results of the
first operation, the second row being the results of the second operation, and the final row
being the results of the final operation for loop, operations, matrix MATLAB Answers — New Questions