Category: News
MS Bookings automatically adding meeting link despite of turining “Add online meeting off”.
Hi everyone. I was trying to create invite using MS bookings, where I have truned off “Add online meeting” option in the settings but still recieving meeting link over the invite. Can anybody help me on this?
Hi everyone. I was trying to create invite using MS bookings, where I have truned off “Add online meeting” option in the settings but still recieving meeting link over the invite. Can anybody help me on this? Read More
Microsoft Fabric – Multi-Tenant Architecture
Fabric Multi-Tenant Architecture
ISVs often face challenges in managing data for multiple tenants in a secure manner while keeping costs low. Traditional solutions may prove costly for scenarios with more than 100 tenants, especially with the common ISV scenario where the volume of trial and free tenants is much larger than the volume of paying tenants.
The motivation for ISVs to use Fabric is that it brings together experiences such as Data Engineering, Data Factory, Data Science, Data Warehouse, Real-Time Analytics, and Power BI onto a shared SaaS foundation.
In this article, we will explore the Workspace per tenant-based architecture, which is a cost-effective solution for managing data for all tenants in Microsoft Fabric, including ETL and reporting.
Challenges of Multi-Tenant Data Solutions
Let us start with the questions that this article will answer:
What are my options to isolate data between tenants?
What are the security requirements/regulation that I should consider?
What are the implications of the various solutions?
Note: You should explore the cost/performance/maintenance aspects of each solution and balance them according to well defined policy that is suited to you as an ISV in specific industry, under specific regulations and upon understanding the sensitivity of the data.
ISVs are reporting that their customers demand solutions that are “fully isolated” in the meaning of data separation between tenants. However, the industry (as well as the regulation) has not defined yet what is “fully isolated.”
The possibility of querying data from multiple tenants is quite common even though it is against the isolated concept. Fabric implementation concepts will be discussed in this article.
Application scenarios:
Microsoft Fabric is designed for multiple application scenarios as defined here.
This article will focus on the typical following two:
1. Data analytics and workflow processing
2. Data gathering, processing, and IoT.
OLTP applications are a native source for Fabric but are not recommended to be the data platform for such systems.
Typical ISVs projects need to ensure that the architecture will support:
Multi-tenants that need data isolation between different tenants. We will discuss briefly what is data isolation in this document.
Power BI reporting.
Performance and cost challenges with relational engine.
Easy migration to Fabric.
The Workspace approach is well-suited to support all those scenarios.
Terminology
OneLake:
OneLake is a single, unified, logical data lake for your whole organization. For our discussions, all the ISV’s tenants’ data will be hosted on the same OneLake. As you can see from the diagram below, Fabric supports multiple services that can connect to OneLake.
Capacity:
A Microsoft Fabric capacity resides on a tenant. Each capacity that sits under a specific tenant is a distinct pool of resources allocated to Microsoft Fabric. The size of the capacity determines the amount of computation power available.
Workspace:
Workspaces reside within capacities and are used as containers for Microsoft Fabric items. Workspace is the place in OneLake that holds the data.
Within a tenant, you can create any number of workspaces. Workspaces enable various parts of the organization to distribute ownership and access policies. Each workspace is part of a capacity that is tied to a specific region and is billed separately.
Within a workspace, you can create data items and you access all data in OneLake through data items. Fabric stores are like lakehouses, warehouses, and other items in OneLake.
Of course. License considerations must take place. Our assumption is that most ISVs will utilize Capacity License.
Data Storage:
The assumption of this article is that a typical ISV wants to store all the data for all his tenants in a central location (multi-region provisioning might be needed due to end-customer location) in a secure and cost-effective way. This is a repeatable demand that we hear from our ISVs. Fabric can offer a new way to achieve this goal by four concepts (more details provided) in this article:
One OneLake for all your data
Tenants’ separation/isolation by workspace
Affordable storage – Parquet files is the storage format. The price per GB is similar the price of Blob storage in the hot tier..
Serverless oriented – no need to pay for unused compute resources.
Data acquiring (ETL and/or IoT) and hybrid scenarios will not be discussed in this article.
Fabric Direct Lake
One of the key components is Fabric Direct Lake, which includes a semantic model capability for analyzing large data volumes in Power BI. Direct Lake is based on loading parquet-formatted files directly from a data lake without having to query a Lakehouse endpoint, and without having to import or duplicate data into a Power BI model.
In other words, Direct Lake eliminates the need to load the data to a relational database or to Power BI and uses Direct Lake as a one-step solution to query the data instead of multiple steps. The following figure (not a replacement for reading the full article here) can help us understand the solution:
As shown in the diagram, Direct Lake streamlines the user’s path by eliminating the need to create, maintain, and pay for a separate lakehouse or warehouse, as well as the need to use import or direct query processes. This results in a more efficient and cost-effective solution for analyzing large data volumes in Power BI.
Workspace based Multi-Tenant Architecture
One of the ground building blocks of Fabric is a workspace. Workspaces are containers that are places to collaborate with colleagues to create collections of items such as lakehouses, warehouses, and reports. You can grant permission per workspace (see the security part later), which can be extremely helpful to associate the tenant’s login with the tenant’s workspace and to his workspace only.
As you can see from the diagram, OneLake can utilize the workspaces for tenant isolation.
Advantages of using workspace per tenant approach:
Security
Avoiding the need to manage security between workspaces
Manageability
The ability to move/delete/archive tenants without any impact on other tenants
Simplicity
One OneLake per ISV; One workspace per tenant; No service to manage and patch
Monitoring
Monitor resource usage per tenant easily
SLA
Ability to give different SLAs to different tenants by provisioning different services according to the tenants’ needs and or budget
Cost per Tenant
Ability to know (and bill) each tenant’s data size according to usage
More reading:
Architect multitenant solutions on Azure
Architecting multitenant solutions on Azure
Resources for architects and developers of multitenant solutions
Better together: the lakehouse and warehouse
Isolation models
Tenant Data Isolation
Due to business, regulation and security considerations, any multi-tenant should ensure that each tenant can access only his data. From a high-level perspective, the solutions that enable us to achieve this granularity are divided into two types:
Physical separation of the data to separate locations.
Ensuring that the application will filter the data from the relevant tenants by mechanisms like Row Level Security.
This document discusses the physical separation type only since this type is aligned with Fabric’s architecture.
Shared data
For shared data the suggested usage is to have a separate workspace that will be shared by a shortcut to all the tenants’ environments. If the shared data is managed by a database, you might be able to use mirroring to sync the database to the shared data workspace. Mirroring is in preview now for Cosmos DB, Azure SQL DB and Snowflake. However, SQL Server, Azure PostgreSQL, Azure MySQL, MongoDB and other databases and data warehouses will be coming in CY24.
Features of Fabric that support multitenancy
Capacities and multi-Region
In Fabric you will have only OneLake per the ISV’s tenant. However, you can deploy your system in multiple regions by having capacity defined in each region.
There is only one OneLake per tenant.
A tenant can have multiple capacities in one or more regions.
Any capacity is attached to a specific region.
A workspace can be assigned to only one capacity.
Every item stored in a lakehouse/warehouse of a workspace will be stored in the region of the tied capacity.
Multitenancy friendly cost structure
Storage
Delta-Parquet files which are the basic building block in Fabric. Those files charged per volume so the number of workspaces will not affect the cost.
Serverless Service
Fabric is a serverless solution which means that there is separation between storage and compute resources payments.
As you expect, you are paying for the storage you are using and you should try to optimize the size of the storage. Since storage costs are low, the storage cost will not be a significant percentage of your total cloud bill.
For compute, you will pay according to the usage. In the BI environment, the user load is expected to vary and such models will save money.
With classic Fabric implementation, you can skip the need for relational database which usually can be one of the main cloud expenses.
ETL
Most ISVs run ETL per tenant, therefore the cost will be the same.
In rare cases where one ETL process can deal with multiple tenants, a single workspace for all tenants might run with less pipelines and save costs.
Power BI
In Power BI, a workspace per tenant is the best practice. Please read the Develop scalable multitenancy applications with Power BI embedding article for deep discussion. From the Power BI perspective, the limitations are based on the largest workspace size (and not on the total workspace size) as defined here.
Capacity and Chargeback Management
The recommended approach for segregating tenants through distinct workspaces facilitates a frequently requested feature: chargeback support. By allocating separate capacities to each tenant’s workspace (or multiple workspaces), monitoring and accessing data regarding each tenant’s usage becomes straightforward.
Microsoft Fabric concepts and licensing article provides essential guidance for creating a deployment that enables ISVs to implement chargeback mechanisms. This allows for precise billing of end customers based on their actual consumption, streamlining the process and ensuring transparency in usage and cost allocation.
Workspace Security
Granular permissions per tenant
As written above, you can use permission per workspace to ensure tenant’s isolation per workspace. The same mechanism is used to give more granular permissions to specific items inside the users of the tenants (good description can be found here).
Note, the same concept is true for permissions inside a lakehouse or warehouse inside a workspace.
For example, the user Mark-CustomerA might be associated with the CustomerA tenant to see only the data related to his tenant. If you want to give him read access to the Orders data you will define a role named OrdersRead-CustomerA and associate Mark with this role. To define a global role OrdersRead instead is possible but will not be a satisfactory solution.
In Fabric you can give permissions by sharing – see here and here. Detail granular permission discussion is beyond the scope of this document – this document is discussing only the security aspects of the multi-tenant scenario.
Multi-tenants Network security
There is no IP separation nor any other network isolation between workspaces. The good news is that a solution is coming. As stated in What’s new and planned for Administration and governance in Microsoft Fabric, Private Link support is planned for Q2 24 (it is not available now and plans might be changed). The Private Link capability will expand from Power BI to other workloads in phases, including workspace-level support. Once Azure Private Link is configured and public internet access is restricted, all the supported scenarios for that workspace will be routed through private links.
Identity Management
We strongly recommend using different users per tenant and not letting an application-based security mechanism to be the only authorization gate.
Please read our Architectural considerations for identity in a multitenant solution.
In these days, you can even utilize multitenant organization in Microsoft Entra ID which is in preview. Detail discussion of this option is beyond the scope of this article. Some highlights can be found in multitenant organization scenario and Microsoft Entra ID capabilities.
The importance of those practices us crucial in ensuring robust security.
More reading:
Security in Microsoft Fabric
Microsoft Fabric: Workspace access, Item level access, SQL policy and object level security
Cross-workspace
Cross-workspace queries
While the demand to have cross-tenant queries looks like opening the system for a security breach, in real life this demand is quite common.
Here are the typical scenarios:
ISV level reporting.
ETL to a data warehouse/data lake.
Using metadata info and/or external data that is relevant to all tenants without the need to duplicate them to all tenants.
To achieve this ability, you should leverage the SQL analytics endpoint that enables querying of any table and easy sharing.
You will need to create a shortcut pointing to the required databases or tables from the other workspace. More details can be found in Cross workspace sharing and querying.
To avoid potential overriding privacy and regulation policies, you should allow cross-tenant queries only in specific cases. You should design such implementation carefully from both security and architecture aspects.
More reading:
Tutorial: Create cross-warehouse queries with the SQL query editor
Querying Lakehouse data from Warehouse in Microsoft Fabric.
Cross-workspace Pipelines
Organizations might separate their data into multi workspaces due to internal security reasons (Separating Gold from Silver/Bronze, according to the data sensitivity).
For other ISVs, the need is even more complex. The data (or at least part of it) comes in a multi-tenant stream and this data should be divided into different single-tenant streams with a minimal effort.
Currently, Fabric does not support this functionality but the ability to enable Cross-workspace Pipelines is in the roadmap.
However, you can clone your data pipelines across workspaces by using the “Save as” button (see here). This makes it easier to develop pipelines collaboratively inside Fabric workspaces without having to redesign your pipelines from scratch. Another solution, based on dynamic content is described here.
Using Cross Workspace Pipelines might simplify the ETL code as well as reduce the expected costs. With proper design, the expected running time of the processes will be better.
Conclusion
If you are an ISV that has multiple tenants, you can use the new Fabric platform to host those tenants. Fabric will help you host the data received from those customers on an isolated basis, paying only for the actual storage that you are using while being able to load the data will all the transformations needed and build a reporting layer for your customers.
Microsoft Tech Community – Latest Blogs –Read More
Issue in getting correct probabilities for Landau Zener Problem
I am trying to solve the Landau Zener problem where i have the equations
I have written a code using Finite Difference as given below. The result is wrong. The correct result is
Can anybody help find the error?
clc;
close all;
%———————————————————————–%
v = 0.1; % sweep velocity
delta =4; % coupling parameter between the ground and excited states
t_max = 1000;
dt = 0.1; % time step
t = -t_max:dt:t_max; % defining time range with step size dt
N = length(t);
b=delta/2;
hbar=1;
%—- initial conditions————-
cg(1:N+1)=1; % initial ground state
ce(1:N+1)=0; % initial excited state
for i=1:N % finite difference loop for advancing in time
a=v*t(i)/2;
cg(i+1)=(dt*a*t(i)/1i*hbar)*cg(i)+cg(i)+ dt*b*ce(i)/1i*hbar;
ce(i+1)=-(dt*a*t(i)/1i*hbar)*ce(i)+ce(i) + dt*b*cg(i)/1i*hbar;
end
% plotting the probabilities in ground and excited states
plot(t,abs(cg(1:N).*cg(1:N)),’linewidth’,2)
hold on
plot(t,abs(ce(1:N).*ce(1:N)),’r’,’linewidth’,2)
xlabel(‘Time’);
ylabel(‘Probability’);
legend(‘|c1|^2’, ‘|c2|^2’)I am trying to solve the Landau Zener problem where i have the equations
I have written a code using Finite Difference as given below. The result is wrong. The correct result is
Can anybody help find the error?
clc;
close all;
%———————————————————————–%
v = 0.1; % sweep velocity
delta =4; % coupling parameter between the ground and excited states
t_max = 1000;
dt = 0.1; % time step
t = -t_max:dt:t_max; % defining time range with step size dt
N = length(t);
b=delta/2;
hbar=1;
%—- initial conditions————-
cg(1:N+1)=1; % initial ground state
ce(1:N+1)=0; % initial excited state
for i=1:N % finite difference loop for advancing in time
a=v*t(i)/2;
cg(i+1)=(dt*a*t(i)/1i*hbar)*cg(i)+cg(i)+ dt*b*ce(i)/1i*hbar;
ce(i+1)=-(dt*a*t(i)/1i*hbar)*ce(i)+ce(i) + dt*b*cg(i)/1i*hbar;
end
% plotting the probabilities in ground and excited states
plot(t,abs(cg(1:N).*cg(1:N)),’linewidth’,2)
hold on
plot(t,abs(ce(1:N).*ce(1:N)),’r’,’linewidth’,2)
xlabel(‘Time’);
ylabel(‘Probability’);
legend(‘|c1|^2’, ‘|c2|^2’) I am trying to solve the Landau Zener problem where i have the equations
I have written a code using Finite Difference as given below. The result is wrong. The correct result is
Can anybody help find the error?
clc;
close all;
%———————————————————————–%
v = 0.1; % sweep velocity
delta =4; % coupling parameter between the ground and excited states
t_max = 1000;
dt = 0.1; % time step
t = -t_max:dt:t_max; % defining time range with step size dt
N = length(t);
b=delta/2;
hbar=1;
%—- initial conditions————-
cg(1:N+1)=1; % initial ground state
ce(1:N+1)=0; % initial excited state
for i=1:N % finite difference loop for advancing in time
a=v*t(i)/2;
cg(i+1)=(dt*a*t(i)/1i*hbar)*cg(i)+cg(i)+ dt*b*ce(i)/1i*hbar;
ce(i+1)=-(dt*a*t(i)/1i*hbar)*ce(i)+ce(i) + dt*b*cg(i)/1i*hbar;
end
% plotting the probabilities in ground and excited states
plot(t,abs(cg(1:N).*cg(1:N)),’linewidth’,2)
hold on
plot(t,abs(ce(1:N).*ce(1:N)),’r’,’linewidth’,2)
xlabel(‘Time’);
ylabel(‘Probability’);
legend(‘|c1|^2’, ‘|c2|^2’) numerical integration, finite difference, schrodinger equation, differential equations MATLAB Answers — New Questions
How to output variables properly from a parfor loop
Having read over the documentation and Googled, I have an idea of what I’m not allowed to do in a parfor loop, but can’t seem to find an answer for how to output variables efficiently. I’ve come up with work-arounds that feel quite hacky and inefficient. Is there a better way of achieving these two things below?
First case: store one value once:
loops = 10000000;
b = 0; % Will try to store value in b but it will silently fail
c = {}; % Cell array to (scucessfully) store just one value
parfor ii = 1:loops
var = ii; % It would just start at zero
% Lots of calculation here, that would change "var" and output other variables too %
if ii == 12345
disp(var)
b = var; % Doesn’t get changed, even though there is no parallelism conflict
c{ii} = var; % Does get set
end
end
b % b is still zero
c = c{end} % Reduce cell array to just one variable. Works
Second case: store a value once every step number of loops:
loops = 10000000;
step = 10000;
a = zeros(loops,1); % Having to create one element for every loop (many more than actually used)
parfor ii = 1:loops
var = ii; % It would just start at zero
% Lots of calculation here, that changes "var" and outputs other variables too %
if mod(ii, step) == 0
a(ii) = var;
end
end
% Remove unused elements. This works, but I had to create a massive array that
% I imagine uses a lot of memory.
a = a(step:step:loops);
Thanks.Having read over the documentation and Googled, I have an idea of what I’m not allowed to do in a parfor loop, but can’t seem to find an answer for how to output variables efficiently. I’ve come up with work-arounds that feel quite hacky and inefficient. Is there a better way of achieving these two things below?
First case: store one value once:
loops = 10000000;
b = 0; % Will try to store value in b but it will silently fail
c = {}; % Cell array to (scucessfully) store just one value
parfor ii = 1:loops
var = ii; % It would just start at zero
% Lots of calculation here, that would change "var" and output other variables too %
if ii == 12345
disp(var)
b = var; % Doesn’t get changed, even though there is no parallelism conflict
c{ii} = var; % Does get set
end
end
b % b is still zero
c = c{end} % Reduce cell array to just one variable. Works
Second case: store a value once every step number of loops:
loops = 10000000;
step = 10000;
a = zeros(loops,1); % Having to create one element for every loop (many more than actually used)
parfor ii = 1:loops
var = ii; % It would just start at zero
% Lots of calculation here, that changes "var" and outputs other variables too %
if mod(ii, step) == 0
a(ii) = var;
end
end
% Remove unused elements. This works, but I had to create a massive array that
% I imagine uses a lot of memory.
a = a(step:step:loops);
Thanks. Having read over the documentation and Googled, I have an idea of what I’m not allowed to do in a parfor loop, but can’t seem to find an answer for how to output variables efficiently. I’ve come up with work-arounds that feel quite hacky and inefficient. Is there a better way of achieving these two things below?
First case: store one value once:
loops = 10000000;
b = 0; % Will try to store value in b but it will silently fail
c = {}; % Cell array to (scucessfully) store just one value
parfor ii = 1:loops
var = ii; % It would just start at zero
% Lots of calculation here, that would change "var" and output other variables too %
if ii == 12345
disp(var)
b = var; % Doesn’t get changed, even though there is no parallelism conflict
c{ii} = var; % Does get set
end
end
b % b is still zero
c = c{end} % Reduce cell array to just one variable. Works
Second case: store a value once every step number of loops:
loops = 10000000;
step = 10000;
a = zeros(loops,1); % Having to create one element for every loop (many more than actually used)
parfor ii = 1:loops
var = ii; % It would just start at zero
% Lots of calculation here, that changes "var" and outputs other variables too %
if mod(ii, step) == 0
a(ii) = var;
end
end
% Remove unused elements. This works, but I had to create a massive array that
% I imagine uses a lot of memory.
a = a(step:step:loops);
Thanks. parfor, parallel computing, variable MATLAB Answers — New Questions
SVM: Does specifying a prior change the cost matrix?
I have an unbalanced data set (1:5). In the documentation, it states:
"If you specify a cost matrix, then the software updates the prior probabilities by incorporating the penalties described in the cost matrix for training."
Does this also work in reverse – i.e. does specifying a prior change the cost matrix? If not, why not? Can you specify both at the same time?
If it does update the cost matrix, then is it correct to leave the prior as the default of "empirical" (which means matched to the training data) and expect it to update the cost matrix accordingly? I guess this will depend on whether I expect the test data (and real world data) to have a 1:5 ratio, right? If I want to to be just as good at classifying one class as the other, should I just specify priors of 0.5 for each of the two classes, or do I need to change the cost matrix too?
Thanks.I have an unbalanced data set (1:5). In the documentation, it states:
"If you specify a cost matrix, then the software updates the prior probabilities by incorporating the penalties described in the cost matrix for training."
Does this also work in reverse – i.e. does specifying a prior change the cost matrix? If not, why not? Can you specify both at the same time?
If it does update the cost matrix, then is it correct to leave the prior as the default of "empirical" (which means matched to the training data) and expect it to update the cost matrix accordingly? I guess this will depend on whether I expect the test data (and real world data) to have a 1:5 ratio, right? If I want to to be just as good at classifying one class as the other, should I just specify priors of 0.5 for each of the two classes, or do I need to change the cost matrix too?
Thanks. I have an unbalanced data set (1:5). In the documentation, it states:
"If you specify a cost matrix, then the software updates the prior probabilities by incorporating the penalties described in the cost matrix for training."
Does this also work in reverse – i.e. does specifying a prior change the cost matrix? If not, why not? Can you specify both at the same time?
If it does update the cost matrix, then is it correct to leave the prior as the default of "empirical" (which means matched to the training data) and expect it to update the cost matrix accordingly? I guess this will depend on whether I expect the test data (and real world data) to have a 1:5 ratio, right? If I want to to be just as good at classifying one class as the other, should I just specify priors of 0.5 for each of the two classes, or do I need to change the cost matrix too?
Thanks. svm, fitcsvm, prior, cost matrix, unbalanced MATLAB Answers — New Questions
Stop an app designer callback thread like the debugger does?
It is evident that whenever the user clicks a button in an app designer app, the callback is called in a new thread. The debugger takes advantage of this, the red "stop" square button obviously terminates the currently running callback thread. Very clean, very effective.
Now, is there any way that I as a programmer can do the same thing? Here’s my problem. I’m building a scientific analysis program, and the users have a lot of options. The wrong options combined with the wrong data can produce a VERY long-running computation, and the user has no good way of getting out of it. Indeed, my users are tending to click extra buttons, setting yet more computations in motion, and it ends up in a meltdown.
So, can I kill the thread, or do I just have to put checkpoints in all my long-running code and check for a stop variable?It is evident that whenever the user clicks a button in an app designer app, the callback is called in a new thread. The debugger takes advantage of this, the red "stop" square button obviously terminates the currently running callback thread. Very clean, very effective.
Now, is there any way that I as a programmer can do the same thing? Here’s my problem. I’m building a scientific analysis program, and the users have a lot of options. The wrong options combined with the wrong data can produce a VERY long-running computation, and the user has no good way of getting out of it. Indeed, my users are tending to click extra buttons, setting yet more computations in motion, and it ends up in a meltdown.
So, can I kill the thread, or do I just have to put checkpoints in all my long-running code and check for a stop variable? It is evident that whenever the user clicks a button in an app designer app, the callback is called in a new thread. The debugger takes advantage of this, the red "stop" square button obviously terminates the currently running callback thread. Very clean, very effective.
Now, is there any way that I as a programmer can do the same thing? Here’s my problem. I’m building a scientific analysis program, and the users have a lot of options. The wrong options combined with the wrong data can produce a VERY long-running computation, and the user has no good way of getting out of it. Indeed, my users are tending to click extra buttons, setting yet more computations in motion, and it ends up in a meltdown.
So, can I kill the thread, or do I just have to put checkpoints in all my long-running code and check for a stop variable? appdesigner, thread MATLAB Answers — New Questions
Possible to iterate over table rows without a loop index variable?
To iterate over the variables (columns) of a table, you can do this:
my_table = table([1; 2; 3], [4; 5; 6], ["Seven"; "Eight"; "Nine"])
for var = my_table
disp(var)
end
Is there a way to adjust this to operate on each row without using an index variable? Using a loop index variable, as follows, works fine but is a bit less elegant than the column-by-column solution.
for row_index = 1:height(my_table)
row = my_table(row_index, :);
disp(row)
endTo iterate over the variables (columns) of a table, you can do this:
my_table = table([1; 2; 3], [4; 5; 6], ["Seven"; "Eight"; "Nine"])
for var = my_table
disp(var)
end
Is there a way to adjust this to operate on each row without using an index variable? Using a loop index variable, as follows, works fine but is a bit less elegant than the column-by-column solution.
for row_index = 1:height(my_table)
row = my_table(row_index, :);
disp(row)
end To iterate over the variables (columns) of a table, you can do this:
my_table = table([1; 2; 3], [4; 5; 6], ["Seven"; "Eight"; "Nine"])
for var = my_table
disp(var)
end
Is there a way to adjust this to operate on each row without using an index variable? Using a loop index variable, as follows, works fine but is a bit less elegant than the column-by-column solution.
for row_index = 1:height(my_table)
row = my_table(row_index, :);
disp(row)
end table, rows, iterate MATLAB Answers — New Questions
Introducing ARCHER, Empowering Every Learner’s Journey, One Arrow at a Time
:direct_hit: ARCHER, is poised to profoundly impact the lives of priority Pre-K-8 learners and their educators by harnessing the transformative power of AI-enabled assessment. At ARCHER, we recognize that early education lays the foundation for a lifetime of learning and achievement. Therefore, our primary goal is to empower both students and educators with tools and resources that facilitate personalized learning experiences, foster academic growth, and promote educational equity. :glowing_star:
Are you passionate about leveraging technology to revolutionize education and empower learners worldwide? We are a team working on this theme for the MIT SOLVE 2024 custom challenge. We’re in need of a few more folks skilled in Technology, and AI to make our project the most impactful one!
Open Position: Technology Department roles
Responsibility:
Software Development
AI integration
Platform optimization
Enhancing educational tools and features
Time Commitment:
There’s 15+ time zones in our community so we don’t hope you attend every meeting. Rather, it’s our expectation that you stay up to date from the information of chats, complete the assigned tasks by deadlines, and if you have any problem with any tasks then you discuss with the admin or specific department team.
Perks of joining the team:
Be a MIT CUSTOM CHALLENGE SOLVER of 2024
Join a potential startup!
Make a great community of friends around the world!
Brush up your skills and work for an amazing cause
How to APPLY:
It’s simple. To apply just send us your previous work experience (might be your resume, portfolio or any project links you’re working on).
You can share your work with:
@ryekarlo on Discord or connect with me through here!
Eagerly waiting to say HI to new teammates!
#ARCHER
:direct_hit: ARCHER, is poised to profoundly impact the lives of priority Pre-K-8 learners and their educators by harnessing the transformative power of AI-enabled assessment. At ARCHER, we recognize that early education lays the foundation for a lifetime of learning and achievement. Therefore, our primary goal is to empower both students and educators with tools and resources that facilitate personalized learning experiences, foster academic growth, and promote educational equity. :glowing_star: Are you passionate about leveraging technology to revolutionize education and empower learners worldwide? We are a team working on this theme for the MIT SOLVE 2024 custom challenge. We’re in need of a few more folks skilled in Technology, and AI to make our project the most impactful one!Open Position: Technology Department rolesResponsibility:Software DevelopmentAI integrationPlatform optimizationEnhancing educational tools and featuresTime Commitment:There’s 15+ time zones in our community so we don’t hope you attend every meeting. Rather, it’s our expectation that you stay up to date from the information of chats, complete the assigned tasks by deadlines, and if you have any problem with any tasks then you discuss with the admin or specific department team. Perks of joining the team: Be a MIT CUSTOM CHALLENGE SOLVER of 2024Join a potential startup!Make a great community of friends around the world!Brush up your skills and work for an amazing cause How to APPLY: It’s simple. To apply just send us your previous work experience (might be your resume, portfolio or any project links you’re working on).You can share your work with:@ryekarlo on Discord or connect with me through here! Eagerly waiting to say HI to new teammates!#ARCHER Read More
HOW TO: Object detection using automotive RADAR
I’m working on an automotive RADAR ( FMCW) for object detection specially pedestrians.
And i want to make a prototype of my system, then testing using the HIL (Hardware In Loop ) Method.
Also i’m working on a GUI using CAN.
If you can provide any informations or advice it will very apperiated.
Here is my contact in case someone needs more DATA about the project: laitoussabd@gmail.comI’m working on an automotive RADAR ( FMCW) for object detection specially pedestrians.
And i want to make a prototype of my system, then testing using the HIL (Hardware In Loop ) Method.
Also i’m working on a GUI using CAN.
If you can provide any informations or advice it will very apperiated.
Here is my contact in case someone needs more DATA about the project: laitoussabd@gmail.com I’m working on an automotive RADAR ( FMCW) for object detection specially pedestrians.
And i want to make a prototype of my system, then testing using the HIL (Hardware In Loop ) Method.
Also i’m working on a GUI using CAN.
If you can provide any informations or advice it will very apperiated.
Here is my contact in case someone needs more DATA about the project: laitoussabd@gmail.com fft, radar, automotive, simulink, matlab, hil, signal processing, dsp, fpga, raspbery pi, gui, bus can MATLAB Answers — New Questions
VARFUN() vis a vis GROUPSUMMARY()
If one uses varfun() to group a set of variables, one can set the output variable name(s) as desired — say one has an Amount for a bunch of things and wants a total by group. It’s nice to be able to label the new table variable ‘Amount’ as well for consistency, not being forced to use the automagically generated name.
However, if one has N groups overall but for one subsection (say a given month out of table of a year or more of data) there is no total for a given group, then one cannot get a zero total for that group for that given month; one only gets the group totals that are present. This also then creates the need to code the use of the result to handle the fact there may not be a value/variable of a given class; also a bother in not having perfectly generic code. (As a side issue, it would surely be nice to also have an option to not return the ‘GrouopCounts’ variable although if one is going to be forced to code around the zero case, then it has its use; I much prefer to have all the code generic instead).
Alternatively, one can use groupsummary() that has the optional input parameter to return the empty groups; but for some reason it won’t let you name the output variable so one has to write another line of code to do that. WHY?
Do others find this as annoying as I; is it worthy of an enhancement request?If one uses varfun() to group a set of variables, one can set the output variable name(s) as desired — say one has an Amount for a bunch of things and wants a total by group. It’s nice to be able to label the new table variable ‘Amount’ as well for consistency, not being forced to use the automagically generated name.
However, if one has N groups overall but for one subsection (say a given month out of table of a year or more of data) there is no total for a given group, then one cannot get a zero total for that group for that given month; one only gets the group totals that are present. This also then creates the need to code the use of the result to handle the fact there may not be a value/variable of a given class; also a bother in not having perfectly generic code. (As a side issue, it would surely be nice to also have an option to not return the ‘GrouopCounts’ variable although if one is going to be forced to code around the zero case, then it has its use; I much prefer to have all the code generic instead).
Alternatively, one can use groupsummary() that has the optional input parameter to return the empty groups; but for some reason it won’t let you name the output variable so one has to write another line of code to do that. WHY?
Do others find this as annoying as I; is it worthy of an enhancement request? If one uses varfun() to group a set of variables, one can set the output variable name(s) as desired — say one has an Amount for a bunch of things and wants a total by group. It’s nice to be able to label the new table variable ‘Amount’ as well for consistency, not being forced to use the automagically generated name.
However, if one has N groups overall but for one subsection (say a given month out of table of a year or more of data) there is no total for a given group, then one cannot get a zero total for that group for that given month; one only gets the group totals that are present. This also then creates the need to code the use of the result to handle the fact there may not be a value/variable of a given class; also a bother in not having perfectly generic code. (As a side issue, it would surely be nice to also have an option to not return the ‘GrouopCounts’ variable although if one is going to be forced to code around the zero case, then it has its use; I much prefer to have all the code generic instead).
Alternatively, one can use groupsummary() that has the optional input parameter to return the empty groups; but for some reason it won’t let you name the output variable so one has to write another line of code to do that. WHY?
Do others find this as annoying as I; is it worthy of an enhancement request? rowfun, varfun, options MATLAB Answers — New Questions
How to get map information from jp2 images ?
I am using following matlab lines to layer stack 6 bands(green,red,nir,rededge5,rededge6,rededge7) of sentinel2 satellite data. I have resampled 10m resolution bands to 20m resolution and successfully writen envi file with header. However, map information like map projection is missing from header file. Please suggest me how to get map information from jp2 formated files into envi header files?
data = imresize(img ,[5490 5490]);
I will appreciate your kind cooperation.
DevendraI am using following matlab lines to layer stack 6 bands(green,red,nir,rededge5,rededge6,rededge7) of sentinel2 satellite data. I have resampled 10m resolution bands to 20m resolution and successfully writen envi file with header. However, map information like map projection is missing from header file. Please suggest me how to get map information from jp2 formated files into envi header files?
data = imresize(img ,[5490 5490]);
I will appreciate your kind cooperation.
Devendra I am using following matlab lines to layer stack 6 bands(green,red,nir,rededge5,rededge6,rededge7) of sentinel2 satellite data. I have resampled 10m resolution bands to 20m resolution and successfully writen envi file with header. However, map information like map projection is missing from header file. Please suggest me how to get map information from jp2 formated files into envi header files?
data = imresize(img ,[5490 5490]);
I will appreciate your kind cooperation.
Devendra how to get map information from jp2 images ? MATLAB Answers — New Questions
How to use Matlab to get georeferencing information of a JP2 image?
Does anyone know how to extract with Matlab the georeferencing information of a JP2 image?
I’d like to read with Matlab the georeferencing metadata contained in a JP2 image. Any idea ? Thanks !Does anyone know how to extract with Matlab the georeferencing information of a JP2 image?
I’d like to read with Matlab the georeferencing metadata contained in a JP2 image. Any idea ? Thanks ! Does anyone know how to extract with Matlab the georeferencing information of a JP2 image?
I’d like to read with Matlab the georeferencing metadata contained in a JP2 image. Any idea ? Thanks ! how to use matlab to get georeferencing ? MATLAB Answers — New Questions
Trouble with my functio out
I am trying to solve my extendet DMP model, which includes the the individuals option to commit crime. In my "function out DMP_steadystate(xx…. ) lacks input in the vaiable I, which is the income from crime. The MatLab error says that the function lacks input, and my question is where does this function receive its input from?I am trying to solve my extendet DMP model, which includes the the individuals option to commit crime. In my "function out DMP_steadystate(xx…. ) lacks input in the vaiable I, which is the income from crime. The MatLab error says that the function lacks input, and my question is where does this function receive its input from? I am trying to solve my extendet DMP model, which includes the the individuals option to commit crime. In my "function out DMP_steadystate(xx…. ) lacks input in the vaiable I, which is the income from crime. The MatLab error says that the function lacks input, and my question is where does this function receive its input from? extendet dmp_model, out function MATLAB Answers — New Questions
loop to quit based on rate of change
i’m trying to get this while loop to quite based on the rate of change of v being less than .05%.
the while loop quits now just based on t(i)<7; but i’m trying to figure out how i can get this loop to stop based on ((v(2)-v(1))/(t(2)-t(1))<= 0.05.
clc
clear
m = 36/1000;
g=9.81;
T=5;
A=.00044316;
Cd=0.75;
rho=1.203;
a(1)=0;
v(1)=0;
h(1)=0;
t(1)=0;
t_step=0.001;
i=1;
u(1)=0;
while t(i)<7;
a(i+1)= ((T)-(m*g)-(0.5*rho*A*Cd*v(i)^2))/m;
v(i+1)= a(i+1)*t_step+v(i);
h(i+1)= v(i+1)*t_step+h(i);
t(i+1)=t(i)+t_step;
i=i+1;
end
plot(t,v)i’m trying to get this while loop to quite based on the rate of change of v being less than .05%.
the while loop quits now just based on t(i)<7; but i’m trying to figure out how i can get this loop to stop based on ((v(2)-v(1))/(t(2)-t(1))<= 0.05.
clc
clear
m = 36/1000;
g=9.81;
T=5;
A=.00044316;
Cd=0.75;
rho=1.203;
a(1)=0;
v(1)=0;
h(1)=0;
t(1)=0;
t_step=0.001;
i=1;
u(1)=0;
while t(i)<7;
a(i+1)= ((T)-(m*g)-(0.5*rho*A*Cd*v(i)^2))/m;
v(i+1)= a(i+1)*t_step+v(i);
h(i+1)= v(i+1)*t_step+h(i);
t(i+1)=t(i)+t_step;
i=i+1;
end
plot(t,v) i’m trying to get this while loop to quite based on the rate of change of v being less than .05%.
the while loop quits now just based on t(i)<7; but i’m trying to figure out how i can get this loop to stop based on ((v(2)-v(1))/(t(2)-t(1))<= 0.05.
clc
clear
m = 36/1000;
g=9.81;
T=5;
A=.00044316;
Cd=0.75;
rho=1.203;
a(1)=0;
v(1)=0;
h(1)=0;
t(1)=0;
t_step=0.001;
i=1;
u(1)=0;
while t(i)<7;
a(i+1)= ((T)-(m*g)-(0.5*rho*A*Cd*v(i)^2))/m;
v(i+1)= a(i+1)*t_step+v(i);
h(i+1)= v(i+1)*t_step+h(i);
t(i+1)=t(i)+t_step;
i=i+1;
end
plot(t,v) loop MATLAB Answers — New Questions
How can i simulate and generate data for acoustic metamaterial ?
I was going through a research article on identifying hidden patterns in metamaterials using Machine Learning. And there the data for training the models was generated through MATLAB. Being completely new to MATLAB how do i proceed?
According to the article to generate the data, dispersion relation along the wavevector contour is evaluated. To evaluate the dispersion relation, a series of eigenvalues problems given by harmonic elastic wave equation with Bloch-Floquet periodic boundary conditions is solved. Then to discretize and solve the eigenvalue problem, Finite Element method using bilinear quadrilateral elements. The boundary conditions are baked into the wavevector-dependent stiffness and mass matrices. This code is implemented in MATLAB.
How can i replicate this ?I was going through a research article on identifying hidden patterns in metamaterials using Machine Learning. And there the data for training the models was generated through MATLAB. Being completely new to MATLAB how do i proceed?
According to the article to generate the data, dispersion relation along the wavevector contour is evaluated. To evaluate the dispersion relation, a series of eigenvalues problems given by harmonic elastic wave equation with Bloch-Floquet periodic boundary conditions is solved. Then to discretize and solve the eigenvalue problem, Finite Element method using bilinear quadrilateral elements. The boundary conditions are baked into the wavevector-dependent stiffness and mass matrices. This code is implemented in MATLAB.
How can i replicate this ? I was going through a research article on identifying hidden patterns in metamaterials using Machine Learning. And there the data for training the models was generated through MATLAB. Being completely new to MATLAB how do i proceed?
According to the article to generate the data, dispersion relation along the wavevector contour is evaluated. To evaluate the dispersion relation, a series of eigenvalues problems given by harmonic elastic wave equation with Bloch-Floquet periodic boundary conditions is solved. Then to discretize and solve the eigenvalue problem, Finite Element method using bilinear quadrilateral elements. The boundary conditions are baked into the wavevector-dependent stiffness and mass matrices. This code is implemented in MATLAB.
How can i replicate this ? database, metamaterials, data generation, finite element, dispersion MATLAB Answers — New Questions
Do we have any work-around for Subproject in P4W
Hello All
With construction projects, there are many sub-projects involved, but P4W does not support Sub-projects. Is there any work-around solution for the need to manage sub-projects?
Thanks
Hello All With construction projects, there are many sub-projects involved, but P4W does not support Sub-projects. Is there any work-around solution for the need to manage sub-projects? Thanks Read More
How to define variable names for resampling?
I am using following code to resample the 10m green,red and nir bands to 20m resolution;
% Resample the 10m bands to 20m
if ismember(files(i + j).name, {‘*_B03_10m.jp2’, ‘*_B04_10m.jp2’, ‘*_B08_10m.jp2’})
img = imresize(img, 0.5, ‘Method’, ‘bilinear’);
end
But this part of code is being not executed.
The names of band files are as follows
T43RGN_20210119T053141_B03_10m
T43RGN_20210119T053141_B04_10m
T43RGN_20210119T053141_B05_20m
T43RGN_20210119T053141_B06_20m
T43RGN_20210119T053141_B07_20m
T43RGN_20210119T053141_B08_10m
I request you to kindly suggest me how to execute above mentioned part of code also.
DevaI am using following code to resample the 10m green,red and nir bands to 20m resolution;
% Resample the 10m bands to 20m
if ismember(files(i + j).name, {‘*_B03_10m.jp2’, ‘*_B04_10m.jp2’, ‘*_B08_10m.jp2’})
img = imresize(img, 0.5, ‘Method’, ‘bilinear’);
end
But this part of code is being not executed.
The names of band files are as follows
T43RGN_20210119T053141_B03_10m
T43RGN_20210119T053141_B04_10m
T43RGN_20210119T053141_B05_20m
T43RGN_20210119T053141_B06_20m
T43RGN_20210119T053141_B07_20m
T43RGN_20210119T053141_B08_10m
I request you to kindly suggest me how to execute above mentioned part of code also.
Deva I am using following code to resample the 10m green,red and nir bands to 20m resolution;
% Resample the 10m bands to 20m
if ismember(files(i + j).name, {‘*_B03_10m.jp2’, ‘*_B04_10m.jp2’, ‘*_B08_10m.jp2’})
img = imresize(img, 0.5, ‘Method’, ‘bilinear’);
end
But this part of code is being not executed.
The names of band files are as follows
T43RGN_20210119T053141_B03_10m
T43RGN_20210119T053141_B04_10m
T43RGN_20210119T053141_B05_20m
T43RGN_20210119T053141_B06_20m
T43RGN_20210119T053141_B07_20m
T43RGN_20210119T053141_B08_10m
I request you to kindly suggest me how to execute above mentioned part of code also.
Deva how to define variable names for resampling? MATLAB Answers — New Questions
Automotive Modelling in real time
Hi; I created a model in simulink. I designed a dashboard for inform the driver. I want to add a video or a model in that model. But I want to work real time. When I run the video or model I should get the CAN datas for sensors, radar, lidar and camera etc. So, as a real time I can do sensor fusion and image processing.Do you suggest öne any tool or method for doing this project.Hi; I created a model in simulink. I designed a dashboard for inform the driver. I want to add a video or a model in that model. But I want to work real time. When I run the video or model I should get the CAN datas for sensors, radar, lidar and camera etc. So, as a real time I can do sensor fusion and image processing.Do you suggest öne any tool or method for doing this project. Hi; I created a model in simulink. I designed a dashboard for inform the driver. I want to add a video or a model in that model. But I want to work real time. When I run the video or model I should get the CAN datas for sensors, radar, lidar and camera etc. So, as a real time I can do sensor fusion and image processing.Do you suggest öne any tool or method for doing this project. automotive simulator, automotive modelling, can data, can communication MATLAB Answers — New Questions
I cannot evaluate “pauseFcn” callback by using “sim” command
Hello, I’m having issues with Simulink callbacks. I’m using MATLAB 2019a.
I have a Simulink model. I am adding a listener to an output of that model by using startFcn callback. I am expecting the model to pause when the output takes a specific value. I am implementing this algorithm inside the listener’s callback function.
When I try this from Simulink by using "Run" button, the results are as expected, i.e., model pauses and the calculations are done within the "pauseFcn". But when I use "sim(‘myModel’)" command in MATLAB, Simulink does not evaluate the pauseFcn even if the condition is triggered.
In addition, I traced the callbacks from command window. I see that, when I use ‘Run’ button, pauseFcn callback is triggered properly and commands in it are evaluated. However, when I use sim command, I see that pauseFcn callback is not triggered.
What should I do to make the model work corretly with sim command? Is this a bug?Hello, I’m having issues with Simulink callbacks. I’m using MATLAB 2019a.
I have a Simulink model. I am adding a listener to an output of that model by using startFcn callback. I am expecting the model to pause when the output takes a specific value. I am implementing this algorithm inside the listener’s callback function.
When I try this from Simulink by using "Run" button, the results are as expected, i.e., model pauses and the calculations are done within the "pauseFcn". But when I use "sim(‘myModel’)" command in MATLAB, Simulink does not evaluate the pauseFcn even if the condition is triggered.
In addition, I traced the callbacks from command window. I see that, when I use ‘Run’ button, pauseFcn callback is triggered properly and commands in it are evaluated. However, when I use sim command, I see that pauseFcn callback is not triggered.
What should I do to make the model work corretly with sim command? Is this a bug? Hello, I’m having issues with Simulink callbacks. I’m using MATLAB 2019a.
I have a Simulink model. I am adding a listener to an output of that model by using startFcn callback. I am expecting the model to pause when the output takes a specific value. I am implementing this algorithm inside the listener’s callback function.
When I try this from Simulink by using "Run" button, the results are as expected, i.e., model pauses and the calculations are done within the "pauseFcn". But when I use "sim(‘myModel’)" command in MATLAB, Simulink does not evaluate the pauseFcn even if the condition is triggered.
In addition, I traced the callbacks from command window. I see that, when I use ‘Run’ button, pauseFcn callback is triggered properly and commands in it are evaluated. However, when I use sim command, I see that pauseFcn callback is not triggered.
What should I do to make the model work corretly with sim command? Is this a bug? simulink, callback, sim, listener MATLAB Answers — New Questions
NaN in converting a sym to double
I have troubles in converting a sym to double using the functions double, vpa and matlabFunction. I need to solve a system of 6 equations in 6 variables.
Here is the code:
% Here I define the symbolic variables and I assign the physical values to the known constants
clear all
clc
syms s C1 C2 C3 C4 C5 C6
c33=(8.674*10^10);
rho=(2.65*10^3);
e33=(0.2);
p3=(4*10^-4);
beta3=(1.16*10^6);
CE=(782);
epsilon3=(0.392*10^-10);
k3=(1.4);
R0=(10/rho);
T0=(293);
v=(0.5);
tau=(0.05);
L=(1);
A=(0.01);
c0=sqrt(c33/rho);
eta0=rho*CE/k3;
% Here I define other parameters which depends from the known constants
a2=c0*eta0*L*e33^2/(epsilon3*c33);
a3=beta3*T0/c33;
b1=c0*eta0*L;
b2=p3*T0/e33;
d1=beta3/(rho*CE);
d2=p3*c0*e33*L/(k3*epsilon3);
d=rho*R0/v;
%Here i define the parameters which depends on variable s
f0=b2*s^2*(b2*d2-b1)/(a2*b2-a3*b1);
f2=1-b2*(d1+s/(a3*(1+tau*s)))+a2*b2^2*s/(a3*(a2*b2-a3*b1)*(1+tau*s))-(b2*d2-b1)*(b2+a3+b2*s^2*A^2)/(a2*b2-a3*b1);
f4=(b2/(a3*s*(1+tau*s)))*(1+(s*A)^2-a2*(b2+a3+b2*(A*s)^2)/(a2*b2-a3*b1));
f=d*b2/v
lambda1=sqrt((-f2+sqrt(f2^2-4*f4*f0))/(2*f4));
lambda2=-lambda1;%ok
lambda3=sqrt((-f2-sqrt(f2^2-4*f4*f0))/(2*f4));
lambda4=-lambda3;%ok
K=f/(f4*(s/v)^4+f2*(s/v)^2+f0);
j1=(b2*s^2/lambda1^2-a3-b2-(s*A)^2*b2)/(b2*a2-b1*a3);
j2=j1;
j3=(b2*s^2/lambda3^2-a3-b2-(A*s)^2*b2)/(b2*a2-b1*a3);
j4=j3;
j=(b2*v^2-b2-a3-(s*A)^2*b2)/(b2*a2-b1*a3);
l1=lambda1*(b1*j1-1)/b2;
l2=-l1;
l3=lambda3*(b1*j3-1)/b2;
l4=-l3;
l=s*(1-b1*j)/v*b2;
%Here i define the system of 6 equations in the 6 variables C1,C2,C3,C4,C5,C6
eq1=C1+C2+C3+C4+K==0;
eq2=C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0)+C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0)+K*exp(-s*c0*eta0/v)==0;
eq3=j1*(C1+C2)+j3*(C3+C4)+j*K+C6==0;
eq4=j1*(C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0))+j3*(C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0))+j*K*exp(-s*c0*eta0/v)+C5*c0*eta0+C6==0;
eq5=l1*lambda1*(C1+C2)+l3*lambda3*(C3+C4)-l*K*(s/v)==0;
eq6=l1*lambda1*(C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0))+l3*lambda3*(C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0))-l*K*(s/v)*exp(-s*c0*eta0/v)==0;
%Here I solve the system using solve and assign the solutions to the
%variables C1Sol, C2Sol, C3Sol etc.
sol=solve([eq1,eq2,eq3,eq4,eq5,eq6],[C1,C2,C3,C4,C5,C6]);
C1Sol=sol.C1;
C2Sol=sol.C2;
C3Sol=sol.C3;
C4Sol=sol.C4;
C5Sol=sol.C5;
C6Sol=sol.C6;
The CiSol (i=1,…,6) solutions i get from this system are symbolic expressions dependent on s. When i try to evaluate some of them using subs and then double:
D=subs(C2Sol,{s},{1})
G=double(D)
what i get as output is NaN. I get an actual result only if I use number <10^(-2), but i need this functions to work with s ranging from 5 to 30.This happens also if i use vpa or matlabFunction instead of double.
I know that this procedure (or something like this) was used in matlab, since it is reported in some scientific papers (doi:10.1088/0964-1726/18/2/025003 and doi: 10.1016/j.heliyon.2018.e00860). They solve the same system and then use the solutions to define functions (u, phi, theta) which they use to perfom numerical Laplace anti-trasform. I cannot do this, since the CiSol that i get seems to not work very well.
Thank you in advance for any help or suggestion.I have troubles in converting a sym to double using the functions double, vpa and matlabFunction. I need to solve a system of 6 equations in 6 variables.
Here is the code:
% Here I define the symbolic variables and I assign the physical values to the known constants
clear all
clc
syms s C1 C2 C3 C4 C5 C6
c33=(8.674*10^10);
rho=(2.65*10^3);
e33=(0.2);
p3=(4*10^-4);
beta3=(1.16*10^6);
CE=(782);
epsilon3=(0.392*10^-10);
k3=(1.4);
R0=(10/rho);
T0=(293);
v=(0.5);
tau=(0.05);
L=(1);
A=(0.01);
c0=sqrt(c33/rho);
eta0=rho*CE/k3;
% Here I define other parameters which depends from the known constants
a2=c0*eta0*L*e33^2/(epsilon3*c33);
a3=beta3*T0/c33;
b1=c0*eta0*L;
b2=p3*T0/e33;
d1=beta3/(rho*CE);
d2=p3*c0*e33*L/(k3*epsilon3);
d=rho*R0/v;
%Here i define the parameters which depends on variable s
f0=b2*s^2*(b2*d2-b1)/(a2*b2-a3*b1);
f2=1-b2*(d1+s/(a3*(1+tau*s)))+a2*b2^2*s/(a3*(a2*b2-a3*b1)*(1+tau*s))-(b2*d2-b1)*(b2+a3+b2*s^2*A^2)/(a2*b2-a3*b1);
f4=(b2/(a3*s*(1+tau*s)))*(1+(s*A)^2-a2*(b2+a3+b2*(A*s)^2)/(a2*b2-a3*b1));
f=d*b2/v
lambda1=sqrt((-f2+sqrt(f2^2-4*f4*f0))/(2*f4));
lambda2=-lambda1;%ok
lambda3=sqrt((-f2-sqrt(f2^2-4*f4*f0))/(2*f4));
lambda4=-lambda3;%ok
K=f/(f4*(s/v)^4+f2*(s/v)^2+f0);
j1=(b2*s^2/lambda1^2-a3-b2-(s*A)^2*b2)/(b2*a2-b1*a3);
j2=j1;
j3=(b2*s^2/lambda3^2-a3-b2-(A*s)^2*b2)/(b2*a2-b1*a3);
j4=j3;
j=(b2*v^2-b2-a3-(s*A)^2*b2)/(b2*a2-b1*a3);
l1=lambda1*(b1*j1-1)/b2;
l2=-l1;
l3=lambda3*(b1*j3-1)/b2;
l4=-l3;
l=s*(1-b1*j)/v*b2;
%Here i define the system of 6 equations in the 6 variables C1,C2,C3,C4,C5,C6
eq1=C1+C2+C3+C4+K==0;
eq2=C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0)+C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0)+K*exp(-s*c0*eta0/v)==0;
eq3=j1*(C1+C2)+j3*(C3+C4)+j*K+C6==0;
eq4=j1*(C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0))+j3*(C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0))+j*K*exp(-s*c0*eta0/v)+C5*c0*eta0+C6==0;
eq5=l1*lambda1*(C1+C2)+l3*lambda3*(C3+C4)-l*K*(s/v)==0;
eq6=l1*lambda1*(C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0))+l3*lambda3*(C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0))-l*K*(s/v)*exp(-s*c0*eta0/v)==0;
%Here I solve the system using solve and assign the solutions to the
%variables C1Sol, C2Sol, C3Sol etc.
sol=solve([eq1,eq2,eq3,eq4,eq5,eq6],[C1,C2,C3,C4,C5,C6]);
C1Sol=sol.C1;
C2Sol=sol.C2;
C3Sol=sol.C3;
C4Sol=sol.C4;
C5Sol=sol.C5;
C6Sol=sol.C6;
The CiSol (i=1,…,6) solutions i get from this system are symbolic expressions dependent on s. When i try to evaluate some of them using subs and then double:
D=subs(C2Sol,{s},{1})
G=double(D)
what i get as output is NaN. I get an actual result only if I use number <10^(-2), but i need this functions to work with s ranging from 5 to 30.This happens also if i use vpa or matlabFunction instead of double.
I know that this procedure (or something like this) was used in matlab, since it is reported in some scientific papers (doi:10.1088/0964-1726/18/2/025003 and doi: 10.1016/j.heliyon.2018.e00860). They solve the same system and then use the solutions to define functions (u, phi, theta) which they use to perfom numerical Laplace anti-trasform. I cannot do this, since the CiSol that i get seems to not work very well.
Thank you in advance for any help or suggestion. I have troubles in converting a sym to double using the functions double, vpa and matlabFunction. I need to solve a system of 6 equations in 6 variables.
Here is the code:
% Here I define the symbolic variables and I assign the physical values to the known constants
clear all
clc
syms s C1 C2 C3 C4 C5 C6
c33=(8.674*10^10);
rho=(2.65*10^3);
e33=(0.2);
p3=(4*10^-4);
beta3=(1.16*10^6);
CE=(782);
epsilon3=(0.392*10^-10);
k3=(1.4);
R0=(10/rho);
T0=(293);
v=(0.5);
tau=(0.05);
L=(1);
A=(0.01);
c0=sqrt(c33/rho);
eta0=rho*CE/k3;
% Here I define other parameters which depends from the known constants
a2=c0*eta0*L*e33^2/(epsilon3*c33);
a3=beta3*T0/c33;
b1=c0*eta0*L;
b2=p3*T0/e33;
d1=beta3/(rho*CE);
d2=p3*c0*e33*L/(k3*epsilon3);
d=rho*R0/v;
%Here i define the parameters which depends on variable s
f0=b2*s^2*(b2*d2-b1)/(a2*b2-a3*b1);
f2=1-b2*(d1+s/(a3*(1+tau*s)))+a2*b2^2*s/(a3*(a2*b2-a3*b1)*(1+tau*s))-(b2*d2-b1)*(b2+a3+b2*s^2*A^2)/(a2*b2-a3*b1);
f4=(b2/(a3*s*(1+tau*s)))*(1+(s*A)^2-a2*(b2+a3+b2*(A*s)^2)/(a2*b2-a3*b1));
f=d*b2/v
lambda1=sqrt((-f2+sqrt(f2^2-4*f4*f0))/(2*f4));
lambda2=-lambda1;%ok
lambda3=sqrt((-f2-sqrt(f2^2-4*f4*f0))/(2*f4));
lambda4=-lambda3;%ok
K=f/(f4*(s/v)^4+f2*(s/v)^2+f0);
j1=(b2*s^2/lambda1^2-a3-b2-(s*A)^2*b2)/(b2*a2-b1*a3);
j2=j1;
j3=(b2*s^2/lambda3^2-a3-b2-(A*s)^2*b2)/(b2*a2-b1*a3);
j4=j3;
j=(b2*v^2-b2-a3-(s*A)^2*b2)/(b2*a2-b1*a3);
l1=lambda1*(b1*j1-1)/b2;
l2=-l1;
l3=lambda3*(b1*j3-1)/b2;
l4=-l3;
l=s*(1-b1*j)/v*b2;
%Here i define the system of 6 equations in the 6 variables C1,C2,C3,C4,C5,C6
eq1=C1+C2+C3+C4+K==0;
eq2=C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0)+C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0)+K*exp(-s*c0*eta0/v)==0;
eq3=j1*(C1+C2)+j3*(C3+C4)+j*K+C6==0;
eq4=j1*(C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0))+j3*(C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0))+j*K*exp(-s*c0*eta0/v)+C5*c0*eta0+C6==0;
eq5=l1*lambda1*(C1+C2)+l3*lambda3*(C3+C4)-l*K*(s/v)==0;
eq6=l1*lambda1*(C1*exp(lambda1*c0*eta0)+C2*exp(-lambda1*c0*eta0))+l3*lambda3*(C3*exp(lambda3*c0*eta0)+C4*exp(-lambda3*c0*eta0))-l*K*(s/v)*exp(-s*c0*eta0/v)==0;
%Here I solve the system using solve and assign the solutions to the
%variables C1Sol, C2Sol, C3Sol etc.
sol=solve([eq1,eq2,eq3,eq4,eq5,eq6],[C1,C2,C3,C4,C5,C6]);
C1Sol=sol.C1;
C2Sol=sol.C2;
C3Sol=sol.C3;
C4Sol=sol.C4;
C5Sol=sol.C5;
C6Sol=sol.C6;
The CiSol (i=1,…,6) solutions i get from this system are symbolic expressions dependent on s. When i try to evaluate some of them using subs and then double:
D=subs(C2Sol,{s},{1})
G=double(D)
what i get as output is NaN. I get an actual result only if I use number <10^(-2), but i need this functions to work with s ranging from 5 to 30.This happens also if i use vpa or matlabFunction instead of double.
I know that this procedure (or something like this) was used in matlab, since it is reported in some scientific papers (doi:10.1088/0964-1726/18/2/025003 and doi: 10.1016/j.heliyon.2018.e00860). They solve the same system and then use the solutions to define functions (u, phi, theta) which they use to perfom numerical Laplace anti-trasform. I cannot do this, since the CiSol that i get seems to not work very well.
Thank you in advance for any help or suggestion. nan, double, vpa MATLAB Answers — New Questions