Category: News
Where to find the generated simscape code
Hi does anyone know where to find the generated simscape code? I simply built a dummy model down below and then used simulink coder to generate the c code. I already know that the Simulink Coder software generates code from the Simscape blocks separately from the Simulink blocks in my model, but where does this file store? and which file contains the c code of the simcape blocks?Hi does anyone know where to find the generated simscape code? I simply built a dummy model down below and then used simulink coder to generate the c code. I already know that the Simulink Coder software generates code from the Simscape blocks separately from the Simulink blocks in my model, but where does this file store? and which file contains the c code of the simcape blocks? Hi does anyone know where to find the generated simscape code? I simply built a dummy model down below and then used simulink coder to generate the c code. I already know that the Simulink Coder software generates code from the Simscape blocks separately from the Simulink blocks in my model, but where does this file store? and which file contains the c code of the simcape blocks? simscape, code generation MATLAB Answers — New Questions
Automatically select the right number of bins (or combine the bins) for the expected frequencies in crosstab, in order to guarantee at least 5 elements per bin
I have two observed datasets, "x" and "y", that I want to compare the observed frequencies in bins of "x" and "y" against the other, through crosstab. To do so, I first need to place the elements of "x" and "y" into bins, by using the histcounts function. The resulting binned arrays, "cx" and "cy", are then compared to each other with a chi-square test, perfomed by crosstab. The chi-square test of independence is performed to determine if there is a significant association between the frequencies of "x" and "y" across the bins.
However, the chi-square test "is not valid for small samples, and if some of the counts (in the expected frequency) are less than five, you may need to combine some bins in the tails.". In the following example, several bins of the observed frequencies "cx" and "cy" have zero elements, and I do not know if they affect the expected frequencies calculated within/by crosstab.
Therefore, is there a way in crosstab to automatically select the right number of bins for the expected frequencies, or to combine them if some are empty, in order to guarantee at least 5 elements per bin?
rng default; % for reproducibility
a = 0;
b = 100;
nb = 50;
% Create two log-normal distributed random datasets, "x" and "y’
% (but we can use any randomly distributed data)
x = (b-a).*round(lognrnd(1,1,1000,1)) + a;
y = (b-a).*round(lognrnd(0.88,1.1,1000,1)) + a;
% Counts/frequency of "x" and "y"
cx = histcounts(x,’NumBins’,nb);
cy = histcounts(y,’NumBins’,nb);
[~,chi2,p] = crosstab(cx,cy)I have two observed datasets, "x" and "y", that I want to compare the observed frequencies in bins of "x" and "y" against the other, through crosstab. To do so, I first need to place the elements of "x" and "y" into bins, by using the histcounts function. The resulting binned arrays, "cx" and "cy", are then compared to each other with a chi-square test, perfomed by crosstab. The chi-square test of independence is performed to determine if there is a significant association between the frequencies of "x" and "y" across the bins.
However, the chi-square test "is not valid for small samples, and if some of the counts (in the expected frequency) are less than five, you may need to combine some bins in the tails.". In the following example, several bins of the observed frequencies "cx" and "cy" have zero elements, and I do not know if they affect the expected frequencies calculated within/by crosstab.
Therefore, is there a way in crosstab to automatically select the right number of bins for the expected frequencies, or to combine them if some are empty, in order to guarantee at least 5 elements per bin?
rng default; % for reproducibility
a = 0;
b = 100;
nb = 50;
% Create two log-normal distributed random datasets, "x" and "y’
% (but we can use any randomly distributed data)
x = (b-a).*round(lognrnd(1,1,1000,1)) + a;
y = (b-a).*round(lognrnd(0.88,1.1,1000,1)) + a;
% Counts/frequency of "x" and "y"
cx = histcounts(x,’NumBins’,nb);
cy = histcounts(y,’NumBins’,nb);
[~,chi2,p] = crosstab(cx,cy) I have two observed datasets, "x" and "y", that I want to compare the observed frequencies in bins of "x" and "y" against the other, through crosstab. To do so, I first need to place the elements of "x" and "y" into bins, by using the histcounts function. The resulting binned arrays, "cx" and "cy", are then compared to each other with a chi-square test, perfomed by crosstab. The chi-square test of independence is performed to determine if there is a significant association between the frequencies of "x" and "y" across the bins.
However, the chi-square test "is not valid for small samples, and if some of the counts (in the expected frequency) are less than five, you may need to combine some bins in the tails.". In the following example, several bins of the observed frequencies "cx" and "cy" have zero elements, and I do not know if they affect the expected frequencies calculated within/by crosstab.
Therefore, is there a way in crosstab to automatically select the right number of bins for the expected frequencies, or to combine them if some are empty, in order to guarantee at least 5 elements per bin?
rng default; % for reproducibility
a = 0;
b = 100;
nb = 50;
% Create two log-normal distributed random datasets, "x" and "y’
% (but we can use any randomly distributed data)
x = (b-a).*round(lognrnd(1,1,1000,1)) + a;
y = (b-a).*round(lognrnd(0.88,1.1,1000,1)) + a;
% Counts/frequency of "x" and "y"
cx = histcounts(x,’NumBins’,nb);
cy = histcounts(y,’NumBins’,nb);
[~,chi2,p] = crosstab(cx,cy) crosstab, binning, binned, array, histcounts MATLAB Answers — New Questions
Text rending issue on Windows Insider?
No text displayed. Does anyone know how to fix this issue?
No text displayed. Does anyone know how to fix this issue? Read More
How to make text underline like this
I have an image of a document that needs to be converted to word. Can anyone tell me how to do this?
It’s clearly not just an underline because there’s obviously more space between the line and the text. I also think it’s not just a bottom border, because when I try to reproduce it, it extends to the full width.
I have an image of a document that needs to be converted to word. Can anyone tell me how to do this? It’s clearly not just an underline because there’s obviously more space between the line and the text. I also think it’s not just a bottom border, because when I try to reproduce it, it extends to the full width. Read More
Tips to Reduce Your Electricity Bill
Lowering your electricity bill is both cost-effective and environmentally friendly. Here are some quick tips to help you save:
Upgrade to Energy-Efficient Appliances: Use ENERGY STAR-rated appliances to cut down on energy consumption.
Improve Insulation: Proper insulation reduces heating and cooling needs by keeping your home’s temperature stable.
Install a Programmable Thermostat: Set temperatures to save energy when you’re not at home.
Switch to LED Lighting: LEDs use less electricity and last longer than traditional bulbs.
Unplug Unused Devices: Avoid phantom energy use by unplugging devices when not in use.
Consider Renewable Energy: Look into solar panels or other renewable options to reduce grid reliance.
Monitor Your Usage: Use online tools or smart meters to track and manage your energy consumption.
For more details on managing your electricity bill and finding savings, visit the FESCO bill management website.
Lowering your electricity bill is both cost-effective and environmentally friendly. Here are some quick tips to help you save:Upgrade to Energy-Efficient Appliances: Use ENERGY STAR-rated appliances to cut down on energy consumption.Improve Insulation: Proper insulation reduces heating and cooling needs by keeping your home’s temperature stable.Install a Programmable Thermostat: Set temperatures to save energy when you’re not at home.Switch to LED Lighting: LEDs use less electricity and last longer than traditional bulbs.Unplug Unused Devices: Avoid phantom energy use by unplugging devices when not in use.Consider Renewable Energy: Look into solar panels or other renewable options to reduce grid reliance.Monitor Your Usage: Use online tools or smart meters to track and manage your energy consumption.For more details on managing your electricity bill and finding savings, visit the FESCO bill management website. Read More
Filtering channel messages in a conversation by date range
I can use a filter query to retrieve chat messages for a specific date range. However, does the Graph API for channel messages in a conversation support filtering messages and replies by date range?
* I’m looking for filter options to retrieve messages and replies within a specific conversation in a teams channel such as the image below, and not the entire message of a channel.
The filter query that works for me in chat messages are these
List Messages in a chat documentation: https://learn.microsoft.com/en-us/graph/api/chat-list-messages?view=graph-rest-1.0&tabs=httpList chat messages filtered by last modified date range:https://graph.microsoft.com/v1.0/chats/19:2da4c29f6d7041eca70b638b43d45437@thread.v2/messages?$top=2&$orderby=lastModifiedDateTime desc&$filter=lastModifiedDateTime gt 2022-09-22T00:00:00.000Z and lastModifiedDateTime lt 2022-09-24T00:00:00.000Z
There’s no filter query option for channel messages in a conversation that I can find for the below HTTP Request.
https://learn.microsoft.com/en-us/graph/api/chatmessage-get?view=graph-rest-1.0&tabs=httpHTTP Request: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}https://learn.microsoft.com/en-us/graph/api/chatmessage-list-replies?view=graph-rest-1.0&tabs=httpHTTP Request: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies
If filter option not supported, is there an alternative way to retrieve channel messages and replies in a conversation by date range?
I can use a filter query to retrieve chat messages for a specific date range. However, does the Graph API for channel messages in a conversation support filtering messages and replies by date range? * I’m looking for filter options to retrieve messages and replies within a specific conversation in a teams channel such as the image below, and not the entire message of a channel. The filter query that works for me in chat messages are theseList Messages in a chat documentation: https://learn.microsoft.com/en-us/graph/api/chat-list-messages?view=graph-rest-1.0&tabs=httpList chat messages filtered by last modified date range:https://graph.microsoft.com/v1.0/chats/19:2da4c29f6d7041eca70b638b43d45437@thread.v2/messages?$top=2&$orderby=lastModifiedDateTime desc&$filter=lastModifiedDateTime gt 2022-09-22T00:00:00.000Z and lastModifiedDateTime lt 2022-09-24T00:00:00.000Z There’s no filter query option for channel messages in a conversation that I can find for the below HTTP Request. https://learn.microsoft.com/en-us/graph/api/chatmessage-get?view=graph-rest-1.0&tabs=httpHTTP Request: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}https://learn.microsoft.com/en-us/graph/api/chatmessage-list-replies?view=graph-rest-1.0&tabs=httpHTTP Request: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies If filter option not supported, is there an alternative way to retrieve channel messages and replies in a conversation by date range? Read More
Conditional Formatting degrees
how do I get the condition to change color if a value is less than 90°? The formatting doesn’t seem to recognize or understand the values in °.
how do I get the condition to change color if a value is less than 90°? The formatting doesn’t seem to recognize or understand the values in °. Read More
Using groups to assign admin roles – works great except…
About a year ago we migrated our internal processes to using Entra ID security groups to manage Entra ID role assignment. It is mostly a good solution, but over time we started finding issues that Microsoft either can’t or is unwilling to fix. Their “solution” is always to “assign the role directly”, which isn’t scalable for an organization that doesn’t own entitlement to PIM. Below are the roles and functionality that are broken if roles are not directly assigned:
Exchange Administrator – Unable to download message trace logs
Groups Administrator / Global Administrator – Unable to configure group expiration policy
Power Platform Administrator / Global Administrator – Unable to elevate to Power Platform System Administrator role in environments
Do others have this issue? Is there any hope of MS actually fixing this, or are we going to have to switch our process back to direct role assignment by some other means?
About a year ago we migrated our internal processes to using Entra ID security groups to manage Entra ID role assignment. It is mostly a good solution, but over time we started finding issues that Microsoft either can’t or is unwilling to fix. Their “solution” is always to “assign the role directly”, which isn’t scalable for an organization that doesn’t own entitlement to PIM. Below are the roles and functionality that are broken if roles are not directly assigned: Exchange Administrator – Unable to download message trace logsGroups Administrator / Global Administrator – Unable to configure group expiration policyPower Platform Administrator / Global Administrator – Unable to elevate to Power Platform System Administrator role in environments Do others have this issue? Is there any hope of MS actually fixing this, or are we going to have to switch our process back to direct role assignment by some other means? Read More
Performing simple Azure Table Storage REST API operations using curl command.
The blog provides guidance to perform simple Table Storage REST API operations such as Create table, Delete Table, Insert entity, Delete entity, Merge entity, Get Table properties, Get Table Storage Stats, Query Table, Query Entities and Update entities operations using curl command.
Let us look at some of the command syntax to perform REST API operations and we will be making use of SAS token as the authentication mechanism. We need to take care of the pointers below while performing the operations via curl command:
Ensure the URL is formed correctly as per the operation you are trying to perform.
The mandatory header needs to be passed along with correct values for it.
Ensure you are appending/removing extra ‘?’ to the SAS token in the URLs accordingly.
Http verb can be GET, PUT or DELETE as provided by the REST API specifications.
So let’s began:
Get Table Storage Properties:
This Rest API gets the properties of an Azure Table Storage account. Reference link for Rest API is:
Get Table Service Properties (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X GET “https://<storageacccountname>.table.core.windows.net/?restype=service&comp=properties<SAS_token>” -H “x-ms-date:2024-02-23T03:24Z” -H “x-ms-version:2020-04-08”
Output:
Get Table Storage Stats:
This Rest API retrieves statistics that are related to replication for Azure Table Storage. This operation works only on the secondary location endpoint when we have RAGRS replication enabled for the storage account. Reference link: Get Table Service Stats (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X GET “https://storageaccount-secondary.table.core.windows.net/?restype=service&comp=stats&<SAS_token>” -H “x-ms-date:2024-02-23T03:24Z” -H “x-ms-version:2020-04-08”
Output:
Query tables:
This Rest API returns a list of tables under the specified account. Reference link: Query Tables (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X GET “https://storageaccount.table.core.windows.net/Tables?<SAS_token>” -H “x-ms-date:2024-02-23T18:16:35Z” -H “x-ms-version:2020-04-08”
Output:
Create table:
This Rest API creates a new table in a storage account. Reference link: Create Table (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X POST “https://storageaccount.table.core.windows.net/Tables?<SAS_token> ” -H “x-ms-date:2024-02-23T18:16:35Z” -H “x-ms-version:2020-04-08” -H “Content-Length: 27” -H “Content-Type: application/json” -d “{“TableName”:”sampletable”}
Output:
Delete table:
This Rest API deletes a table in a storage account. Reference link: Delete Table (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X DELETE “https://storageaccount.table.core.windows.net/Tables(‘sampletable’)?<SAS_token> ” -H “x-ms-date:2024-02-23T18:16:35Z” -H “x-ms-version:2020-04-08” -H “Content-Type: application/json”
Output:
Query Entities:
This Rest API queries entities in a table and includes the $filter and $select options. Reference link: Query Entities (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X GET “https://storageaccount.table.core.windows.net/shswadsampletable1(PartitionKey=’B’,RowKey=’1′)?<SAS_token> ” -H “x-ms-date:2024-02-24T10:14:50.2646880Z” -H “x-ms-version:2020-04-08”
Output:
Delete Entity Operation:
This Rest API deletes an existing entity in a table. Reference link: Delete Entity (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X DELETE “https://storageaccount.table.core.windows.net/shswadsampletable1(PartitionKey%3D’B’%2C%20RowKey%3D’1′)?<SAS_token> ” -H “x-ms-date:2024-02-24T11:14:50.2646880Z” -H “x-ms-version:2020-04-08” -H “If-Match:*”
Output:
Insert Operation:
This Rest API inserts a new entity into a table. Reference link: Insert Entity (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X POST “https://storageaccount.table.core.windows.net/test?<SAS_token> ” -H “x-ms-date: 2024-02-25T10:39:50.2646880Z” -H “x-ms-version: 2020-04-08” -H “Accept: application/json;odata=nometadata” -H “Content-Type: application/json” -d “{“RowKey”:”bbb”,”PartitionKey”:”ssss”,”Name”:”aaa”,”PhoneNumber”:”111″}”
Output:
Update operation:
This Rest API updates the existing entity in the Table Storage. Reference link: Update Entity (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X PUT “https://storageaccount.table.core.windows.net/test(PartitionKey%3D’ss’%2C%20RowKey%3D’bbb’)?<SAS_token> ” -H “x-ms-date: 2024-02-25T10:39:50.2646880Z” -H “x-ms-version: 2020-04-08” -H “Accept: application/json;odata=nometadata” -H “Content-Type: application/json” -H “If-Match=*” -d “{“RowKey”:”bbb”,”PartitionKey”:”ssss”,”Name”:”aaa”,”PhoneNumber”:”111″}
Output
Merge operation:
This Rest API operation updates an existing entity by updating the entity’s properties and does not replace the existing entity, Reference link: Merge Entity (REST API) – Azure Storage | Microsoft Learn
Syntax URL:
curl -X PUT “https://storageaccount.table.core.windows.net/test(PartitionKey%3D’ssss’%2C%20RowKey%3D’bbb’)?<SAS_token> ” -H “x-ms-version: 2020-04-08” -H “Accept: application/json;odata=nometadata” -H “Content-Type: application/json” -H “If-Match=*” -d “{“RowKey”:”bbb”,”PartitionKey”:”ssss”,”Name”:”aaa”,”PhoneNumber”:”11231″}”
Output:
Hope this article helps you in performing the Table Storage operations by making use of curl command.
Happy Learning!
Microsoft Tech Community – Latest Blogs –Read More
rtwbuild doesn’t generate modelsources.txt in MATLAB 2023
I have used rtwbuild in MATLAB 2020a and it generated modelsources.txt.
MATLAB 2023a doesn’t generate this file. Please help me to solve it.I have used rtwbuild in MATLAB 2020a and it generated modelsources.txt.
MATLAB 2023a doesn’t generate this file. Please help me to solve it. I have used rtwbuild in MATLAB 2020a and it generated modelsources.txt.
MATLAB 2023a doesn’t generate this file. Please help me to solve it. 2023a, simulink MATLAB Answers — New Questions
RMS Analysis on BIN File in Simulink
I am trying to import a BIN file into Simulink and analyze it for RMS. I currently have the sine wave, RMS, and scope blocks, and I can generate a sample sine wave, but I have no way of importing my BIN files. They are large, and I attempted using the Binary File Reader block, and while it started creating a sine wave, it was taking too long to run. How do I make this process more efficient?I am trying to import a BIN file into Simulink and analyze it for RMS. I currently have the sine wave, RMS, and scope blocks, and I can generate a sample sine wave, but I have no way of importing my BIN files. They are large, and I attempted using the Binary File Reader block, and while it started creating a sine wave, it was taking too long to run. How do I make this process more efficient? I am trying to import a BIN file into Simulink and analyze it for RMS. I currently have the sine wave, RMS, and scope blocks, and I can generate a sample sine wave, but I have no way of importing my BIN files. They are large, and I attempted using the Binary File Reader block, and while it started creating a sine wave, it was taking too long to run. How do I make this process more efficient? simulink, binary, statistics MATLAB Answers — New Questions
How to update a function with output from another function?
I am trying to solve for heat transfer coefficients so that I can use them to calculate gas and tank wall temperatures. Currently, I am using constant heat transfer coefficients to enable the calculation of the desired temperatures with ode45.
% Convective heat transfer coefficients
h_in = 25; % Convective heat transfer coefficient inside the tank (W/(m^2·K))
h_out = 6; % Convective heat transfer coefficient outside the tank (W/(m^2·K))
% Solve the coupled ODEs and PDE
[t, y] = ode45(@(t, y) odes(t, y, R, C_p_gas, k_liner, k_CFRP, rho_liner, rho_CFRP, C_p_liner, C_p_CFRP, h_in, h_out, T_ambient, A_in, A_out, dx_liner, dx_CFRP, N_liner, N_CFRP, V, mdot_out), tspan, initial_conditions);
% Extract time histories for inside and outside wall temperatures
T_wall_liner_interface = y(:,3); % Inside wall temperature (first point of the liner)
T_wall_CFRP_interface = y(:,end); % Outside wall temperature (last point of the CFRP layer)
What I would like to do is to use the output temperatures from the ode45 to solve for h_in and h_out, which will in turn be used by ode45 to solve for new temperatures. The h_in and h_out calculations look like this:
function [h_in, h_out]=heat_transfer_coefficients
Di = 0.230; % Internal diameter in meters
Do = 0.279; % External diameter in meters
T_gf = 266.17; %(K) – Type III hydrogen gas T at film temp
rho_gf = 39.16; %(kg/m^3) – Type III hydrogen gas density @ T_gf
Cp_gf = 0.01514*((T_gf/100)^4.789)+1002;
mu_gf = (-4.127*10^-7)*((T_gf/100)^2)+((7.258*10^-6)*(T_gf/100))+(4.094*10^-7);
lambda_gf = ((-3.77*10^-4)*(T_gf/100)^2)+((1.004*10^-2)*(T_gf/100))-(4.776*10^-4);
beta_gf = 1/T_gf; %volumetric thermal expansion coefficient
g = 9.81; %gravitational acceleration (m/s^2)
Rai = (rho_gf^2*(Di^3)*beta_gf*g*(T_wall_liner_interface-T_gas)*Cp_gf)/(mu_gf*lambda_gf); %Rayleigh number at inner wall
if Rai < 10^8
Nu_i = 1.15*Rai.^0.22;
else
Nu_i = 0.14*Rai.^0.333;
end
ki = 168.9e3; %thermal conductivity inside tank at T_g, Type III (W/m*K)
h_in = (Nu_i*ki)/Di;
T_ambf = 279.43; %(K) – Type III
rho_ambf = 1.263; %(kg/m^3) – density @ T_ambf
c_wind = 0; %(m/s) – cross wind velocity
Cp_ambf = 0.01514*((T_ambf/100)^4.789)+1002;
mu_ambf = (-4.127*10^-7)*((T_ambf/100)^2)+((7.258*10^-6)*(T_ambf/100))+(4.094*10^-7);
lambda_ambf = ((-3.77*10^-4)*(T_ambf/100)^2)+((1.004*10^-2)*(T_ambf/100))-(4.776*10^-4);
beta_ambf = 1/T_ambf; %volumetric thermal expansion coefficient
Re_Do = (rho_ambf*c_wind*Do)/(mu_ambf);
Pr_ambf = (mu_ambf*Cp_ambf)/lambda_ambf;
if Re_Do == 0
Nu_cylforced = 0;
Nu_sphforced = 0;
else
Nu_cylforced = 0.3+((0.62*(Re_Do^0.5)*(Pr_ambf^(1/3)))/(1+(0.4/((Pr_ambf))^(2/3)))^(1/4))…
*(1+(Re_Do/282000)^5/8)^4/5;
Nu_sphforced = 2 + ((Re_Do/4)+((3*10^-4)*Re_Do^1.6))^0.5;
end
Rao = (rho_ambf^2*(Do^3)*beta_ambf*g*(T_amb-T_wall_CFRP_interface)*Cp_ambf)/(mu_ambf*lambda_ambf); %Rayleigh number at inner wall
Nu_oforced = ((Nu_cylforced*0.72)+(Nu_sphforced*0.24))/(0.72+0.24);
Nu_ofree = (0.6+((0.387*(Rao.^(1/6)))/(1+(0.559/Pr_ambf)^(9/16)).^(8/27))).^2;
Nu_o = ((Nu_ofree.^4)+(Nu_oforced^4)).^0.25;
ko = 24.84e3; %thermal conductivity outside tank at T_wo, Type III (W/m*K)
h_out = (Nu_o*ko)/Do;
end
As can be seen in the above code, the h_in and h_out calculations require T_gas, T_wall_liner interface and T_wall_CFRP_interface, which currently are being calculated after h_in and h_out. Can somebody please show me a way I can incorporate the h_in and h_out calculations into the first section of code? For ease of explanation and solving, please feel free to use your own numbers for the constants in the ode45 solver line.I am trying to solve for heat transfer coefficients so that I can use them to calculate gas and tank wall temperatures. Currently, I am using constant heat transfer coefficients to enable the calculation of the desired temperatures with ode45.
% Convective heat transfer coefficients
h_in = 25; % Convective heat transfer coefficient inside the tank (W/(m^2·K))
h_out = 6; % Convective heat transfer coefficient outside the tank (W/(m^2·K))
% Solve the coupled ODEs and PDE
[t, y] = ode45(@(t, y) odes(t, y, R, C_p_gas, k_liner, k_CFRP, rho_liner, rho_CFRP, C_p_liner, C_p_CFRP, h_in, h_out, T_ambient, A_in, A_out, dx_liner, dx_CFRP, N_liner, N_CFRP, V, mdot_out), tspan, initial_conditions);
% Extract time histories for inside and outside wall temperatures
T_wall_liner_interface = y(:,3); % Inside wall temperature (first point of the liner)
T_wall_CFRP_interface = y(:,end); % Outside wall temperature (last point of the CFRP layer)
What I would like to do is to use the output temperatures from the ode45 to solve for h_in and h_out, which will in turn be used by ode45 to solve for new temperatures. The h_in and h_out calculations look like this:
function [h_in, h_out]=heat_transfer_coefficients
Di = 0.230; % Internal diameter in meters
Do = 0.279; % External diameter in meters
T_gf = 266.17; %(K) – Type III hydrogen gas T at film temp
rho_gf = 39.16; %(kg/m^3) – Type III hydrogen gas density @ T_gf
Cp_gf = 0.01514*((T_gf/100)^4.789)+1002;
mu_gf = (-4.127*10^-7)*((T_gf/100)^2)+((7.258*10^-6)*(T_gf/100))+(4.094*10^-7);
lambda_gf = ((-3.77*10^-4)*(T_gf/100)^2)+((1.004*10^-2)*(T_gf/100))-(4.776*10^-4);
beta_gf = 1/T_gf; %volumetric thermal expansion coefficient
g = 9.81; %gravitational acceleration (m/s^2)
Rai = (rho_gf^2*(Di^3)*beta_gf*g*(T_wall_liner_interface-T_gas)*Cp_gf)/(mu_gf*lambda_gf); %Rayleigh number at inner wall
if Rai < 10^8
Nu_i = 1.15*Rai.^0.22;
else
Nu_i = 0.14*Rai.^0.333;
end
ki = 168.9e3; %thermal conductivity inside tank at T_g, Type III (W/m*K)
h_in = (Nu_i*ki)/Di;
T_ambf = 279.43; %(K) – Type III
rho_ambf = 1.263; %(kg/m^3) – density @ T_ambf
c_wind = 0; %(m/s) – cross wind velocity
Cp_ambf = 0.01514*((T_ambf/100)^4.789)+1002;
mu_ambf = (-4.127*10^-7)*((T_ambf/100)^2)+((7.258*10^-6)*(T_ambf/100))+(4.094*10^-7);
lambda_ambf = ((-3.77*10^-4)*(T_ambf/100)^2)+((1.004*10^-2)*(T_ambf/100))-(4.776*10^-4);
beta_ambf = 1/T_ambf; %volumetric thermal expansion coefficient
Re_Do = (rho_ambf*c_wind*Do)/(mu_ambf);
Pr_ambf = (mu_ambf*Cp_ambf)/lambda_ambf;
if Re_Do == 0
Nu_cylforced = 0;
Nu_sphforced = 0;
else
Nu_cylforced = 0.3+((0.62*(Re_Do^0.5)*(Pr_ambf^(1/3)))/(1+(0.4/((Pr_ambf))^(2/3)))^(1/4))…
*(1+(Re_Do/282000)^5/8)^4/5;
Nu_sphforced = 2 + ((Re_Do/4)+((3*10^-4)*Re_Do^1.6))^0.5;
end
Rao = (rho_ambf^2*(Do^3)*beta_ambf*g*(T_amb-T_wall_CFRP_interface)*Cp_ambf)/(mu_ambf*lambda_ambf); %Rayleigh number at inner wall
Nu_oforced = ((Nu_cylforced*0.72)+(Nu_sphforced*0.24))/(0.72+0.24);
Nu_ofree = (0.6+((0.387*(Rao.^(1/6)))/(1+(0.559/Pr_ambf)^(9/16)).^(8/27))).^2;
Nu_o = ((Nu_ofree.^4)+(Nu_oforced^4)).^0.25;
ko = 24.84e3; %thermal conductivity outside tank at T_wo, Type III (W/m*K)
h_out = (Nu_o*ko)/Do;
end
As can be seen in the above code, the h_in and h_out calculations require T_gas, T_wall_liner interface and T_wall_CFRP_interface, which currently are being calculated after h_in and h_out. Can somebody please show me a way I can incorporate the h_in and h_out calculations into the first section of code? For ease of explanation and solving, please feel free to use your own numbers for the constants in the ode45 solver line. I am trying to solve for heat transfer coefficients so that I can use them to calculate gas and tank wall temperatures. Currently, I am using constant heat transfer coefficients to enable the calculation of the desired temperatures with ode45.
% Convective heat transfer coefficients
h_in = 25; % Convective heat transfer coefficient inside the tank (W/(m^2·K))
h_out = 6; % Convective heat transfer coefficient outside the tank (W/(m^2·K))
% Solve the coupled ODEs and PDE
[t, y] = ode45(@(t, y) odes(t, y, R, C_p_gas, k_liner, k_CFRP, rho_liner, rho_CFRP, C_p_liner, C_p_CFRP, h_in, h_out, T_ambient, A_in, A_out, dx_liner, dx_CFRP, N_liner, N_CFRP, V, mdot_out), tspan, initial_conditions);
% Extract time histories for inside and outside wall temperatures
T_wall_liner_interface = y(:,3); % Inside wall temperature (first point of the liner)
T_wall_CFRP_interface = y(:,end); % Outside wall temperature (last point of the CFRP layer)
What I would like to do is to use the output temperatures from the ode45 to solve for h_in and h_out, which will in turn be used by ode45 to solve for new temperatures. The h_in and h_out calculations look like this:
function [h_in, h_out]=heat_transfer_coefficients
Di = 0.230; % Internal diameter in meters
Do = 0.279; % External diameter in meters
T_gf = 266.17; %(K) – Type III hydrogen gas T at film temp
rho_gf = 39.16; %(kg/m^3) – Type III hydrogen gas density @ T_gf
Cp_gf = 0.01514*((T_gf/100)^4.789)+1002;
mu_gf = (-4.127*10^-7)*((T_gf/100)^2)+((7.258*10^-6)*(T_gf/100))+(4.094*10^-7);
lambda_gf = ((-3.77*10^-4)*(T_gf/100)^2)+((1.004*10^-2)*(T_gf/100))-(4.776*10^-4);
beta_gf = 1/T_gf; %volumetric thermal expansion coefficient
g = 9.81; %gravitational acceleration (m/s^2)
Rai = (rho_gf^2*(Di^3)*beta_gf*g*(T_wall_liner_interface-T_gas)*Cp_gf)/(mu_gf*lambda_gf); %Rayleigh number at inner wall
if Rai < 10^8
Nu_i = 1.15*Rai.^0.22;
else
Nu_i = 0.14*Rai.^0.333;
end
ki = 168.9e3; %thermal conductivity inside tank at T_g, Type III (W/m*K)
h_in = (Nu_i*ki)/Di;
T_ambf = 279.43; %(K) – Type III
rho_ambf = 1.263; %(kg/m^3) – density @ T_ambf
c_wind = 0; %(m/s) – cross wind velocity
Cp_ambf = 0.01514*((T_ambf/100)^4.789)+1002;
mu_ambf = (-4.127*10^-7)*((T_ambf/100)^2)+((7.258*10^-6)*(T_ambf/100))+(4.094*10^-7);
lambda_ambf = ((-3.77*10^-4)*(T_ambf/100)^2)+((1.004*10^-2)*(T_ambf/100))-(4.776*10^-4);
beta_ambf = 1/T_ambf; %volumetric thermal expansion coefficient
Re_Do = (rho_ambf*c_wind*Do)/(mu_ambf);
Pr_ambf = (mu_ambf*Cp_ambf)/lambda_ambf;
if Re_Do == 0
Nu_cylforced = 0;
Nu_sphforced = 0;
else
Nu_cylforced = 0.3+((0.62*(Re_Do^0.5)*(Pr_ambf^(1/3)))/(1+(0.4/((Pr_ambf))^(2/3)))^(1/4))…
*(1+(Re_Do/282000)^5/8)^4/5;
Nu_sphforced = 2 + ((Re_Do/4)+((3*10^-4)*Re_Do^1.6))^0.5;
end
Rao = (rho_ambf^2*(Do^3)*beta_ambf*g*(T_amb-T_wall_CFRP_interface)*Cp_ambf)/(mu_ambf*lambda_ambf); %Rayleigh number at inner wall
Nu_oforced = ((Nu_cylforced*0.72)+(Nu_sphforced*0.24))/(0.72+0.24);
Nu_ofree = (0.6+((0.387*(Rao.^(1/6)))/(1+(0.559/Pr_ambf)^(9/16)).^(8/27))).^2;
Nu_o = ((Nu_ofree.^4)+(Nu_oforced^4)).^0.25;
ko = 24.84e3; %thermal conductivity outside tank at T_wo, Type III (W/m*K)
h_out = (Nu_o*ko)/Do;
end
As can be seen in the above code, the h_in and h_out calculations require T_gas, T_wall_liner interface and T_wall_CFRP_interface, which currently are being calculated after h_in and h_out. Can somebody please show me a way I can incorporate the h_in and h_out calculations into the first section of code? For ease of explanation and solving, please feel free to use your own numbers for the constants in the ode45 solver line. function MATLAB Answers — New Questions
Unable to recognise function from called script
I created this function in a scipted named "lab1_script.m":
t = [1, 2, 3, 4]
function y = lab1_function(t, c)
y = c*t.^2;
end
But when I try to call the script in a new script as follows:
lab1_script;
y = lab1_function(t,0.1)
The error message: unrecognisable function or variable ‘lab1_function’ appears. And I know that the function works, because when I call it within the same script it is fine. It is just trying to call it into a different script that I am having trouble with.
I am confused, what am I doing wrong? Should I be calling the script a different way for the function to be recognised?
Thanks in advance! :)I created this function in a scipted named "lab1_script.m":
t = [1, 2, 3, 4]
function y = lab1_function(t, c)
y = c*t.^2;
end
But when I try to call the script in a new script as follows:
lab1_script;
y = lab1_function(t,0.1)
The error message: unrecognisable function or variable ‘lab1_function’ appears. And I know that the function works, because when I call it within the same script it is fine. It is just trying to call it into a different script that I am having trouble with.
I am confused, what am I doing wrong? Should I be calling the script a different way for the function to be recognised?
Thanks in advance! 🙂 I created this function in a scipted named "lab1_script.m":
t = [1, 2, 3, 4]
function y = lab1_function(t, c)
y = c*t.^2;
end
But when I try to call the script in a new script as follows:
lab1_script;
y = lab1_function(t,0.1)
The error message: unrecognisable function or variable ‘lab1_function’ appears. And I know that the function works, because when I call it within the same script it is fine. It is just trying to call it into a different script that I am having trouble with.
I am confused, what am I doing wrong? Should I be calling the script a different way for the function to be recognised?
Thanks in advance! 🙂 function, calling script MATLAB Answers — New Questions
Audio quality very poor – August 2024
Anyone else expereincing very ppor audio quality on Teams calls recently?
My experience is
– no problem connecting to calls – with both video and audio and screensharing
– randomly and on all participant – audio periodically cuts out go 1-5 seconds
– happens on all Teams meetings over last couple of weeks
……..so it sounds like a Microsoft issue
Any and all solutions very welcome
Anyone else expereincing very ppor audio quality on Teams calls recently?My experience is- no problem connecting to calls – with both video and audio and screensharing- randomly and on all participant – audio periodically cuts out go 1-5 seconds- happens on all Teams meetings over last couple of weeks ……..so it sounds like a Microsoft issue Any and all solutions very welcome Read More
Excel Table List, Property Columns disappearing in Power Query
Previously the File Contents of the Source files would display like this in Power Query
And recently the file contents displays like this in Power Query. Which is missing the Columns for Item, Kind and Hidden
The result is that all the Power Queries that used to work are now breaking. If anyone can help me crack this case it would be hugely appreciated, I cant change my query because I need to combine the data from the old files and the new files.
I am running Excel Version 2407 Build 16.0.17830.20056) 32-bit
I have a number of Source data Excel Files which all have an identical structure. All have the same queries that load into the files and the same named ranges. I have checked and all the queries have the same privacy setting of Organizational. Previously the File Contents of the Source files would display like this in Power Query And recently the file contents displays like this in Power Query. Which is missing the Columns for Item, Kind and Hidden The result is that all the Power Queries that used to work are now breaking. If anyone can help me crack this case it would be hugely appreciated, I cant change my query because I need to combine the data from the old files and the new files. I am running Excel Version 2407 Build 16.0.17830.20056) 32-bit Read More
REST endpoint for querying in log traces (kusto based)
Do anyone here know if there exists a REST endpoint for querying in log traces (kusto based) like this sample:
traces
| where timestamp > ago(60m)
| parse message with xx “instance=” instance “,” yy
| summarize [‘instances’] = dcount(instance) by bin(timestamp, 60sec)
It works in Azure portal but I would like to execute the query programmatically and not through a UI.
/kristian
Do anyone here know if there exists a REST endpoint for querying in log traces (kusto based) like this sample: traces| where timestamp > ago(60m)| parse message with xx “instance=” instance “,” yy| summarize [‘instances’] = dcount(instance) by bin(timestamp, 60sec) It works in Azure portal but I would like to execute the query programmatically and not through a UI. /kristian Read More
What does it mean by the premium version of Word?
This message pops up from time to time. I am currently using 2017 Professional.
This message pops up from time to time. I am currently using 2017 Professional. Read More
Any easy way to clean up the app list for speeding up the PC?
It is a huge app list from checking the task manager. And I don’t even know some of the apps. How to delete them in bulk?
It is a huge app list from checking the task manager. And I don’t even know some of the apps. How to delete them in bulk? Read More
Is Window 10 still worth having?
I’ve started to wonder if it’s time to consider switching to a different operating system. I value simplicity and reliability over fancy features, and I’m starting to feel like Windows 10 is no longer meeting my needs. Has anyone else had similar experiences or concerns about Windows 10? Are there any other operating systems out there that might be a better fit for me?
I’ve started to wonder if it’s time to consider switching to a different operating system. I value simplicity and reliability over fancy features, and I’m starting to feel like Windows 10 is no longer meeting my needs. Has anyone else had similar experiences or concerns about Windows 10? Are there any other operating systems out there that might be a better fit for me? Read More