Month: July 2024
Get-azureADApplication using ObjectID
Hi All, I have exported a csv file by running Get-OrganizationAddIn cmdlet script , but with that file i am not able to find out the owners of these integradted apps. Now i am importing this CSV file into Get-AzureADApplication cmdlet but i am unable to list any results by using the filter for ServicePrincipalObjectID , I am thinking just because it is going through thousands of applications within the tenant, so any help would be really helpful. Below is the snippet:
$securityid = Import-Csv -Path C:TempOrgAddins-25Jul2024-162827.csv | select -ExpandProperty ServicePrincipalObjectId foreach($id in $securityid) { Get-AzureADApplication -ObjectId $id -all $true}
Hi All, I have exported a csv file by running Get-OrganizationAddIn cmdlet script , but with that file i am not able to find out the owners of these integradted apps. Now i am importing this CSV file into Get-AzureADApplication cmdlet but i am unable to list any results by using the filter for ServicePrincipalObjectID , I am thinking just because it is going through thousands of applications within the tenant, so any help would be really helpful. Below is the snippet: $securityid = Import-Csv -Path C:TempOrgAddins-25Jul2024-162827.csv | select -ExpandProperty ServicePrincipalObjectId foreach($id in $securityid) { Get-AzureADApplication -ObjectId $id -all $true} Read More
CIS/STIG Benchmark in MSD for Endpoint
Hi Team,
I have enabled M365 E5 trial license for a customer, while configuring the Profile, I do not find the CIS option I can just view STIG under the dropdown, I read that “Security baselines provide support for Center for Internet Security (CIS) benchmarks for Windows 10, Windows 11, and Windows Server 2008 R2 and above, as well as Security Technical Implementation Guides (STIG) benchmarks for Windows 10 and Windows Server 2019.”
My customer is having both Windows 10 and Windows 11 devices, now in this scenario for Windows 11 STIG will work?
And also I want to know any MS document which lists all STIG for Windows 10/11 and its best practise.
Thanks in advance
Furqhan
Hi Team, I have enabled M365 E5 trial license for a customer, while configuring the Profile, I do not find the CIS option I can just view STIG under the dropdown, I read that “Security baselines provide support for Center for Internet Security (CIS) benchmarks for Windows 10, Windows 11, and Windows Server 2008 R2 and above, as well as Security Technical Implementation Guides (STIG) benchmarks for Windows 10 and Windows Server 2019.” My customer is having both Windows 10 and Windows 11 devices, now in this scenario for Windows 11 STIG will work? And also I want to know any MS document which lists all STIG for Windows 10/11 and its best practise. Thanks in advanceFurqhan Read More
Why have I had an email saying we’ve used up all of our (120) minutes plan?
Hello
Please i need your help on this issue.
one of my client reported an issue Where they have received an email saying we’ve used up all of their (120) minutes plan?
Then later on they received another one saying we’ve used 100% of our 3000 minutes.
They are able to make calls. They do not make international calls and this functionality is blocked as a result (premium rate calls).
They are receiving email stating they have used up his 3000minute and 1200minutes for calling plan
They are able to make calls
But they cannot make call international numbers
They are on PSTN1 and PSTN 5 shows that we has available unit.
Hello Please i need your help on this issue. one of my client reported an issue Where they have received an email saying we’ve used up all of their (120) minutes plan? Then later on they received another one saying we’ve used 100% of our 3000 minutes. They are able to make calls. They do not make international calls and this functionality is blocked as a result (premium rate calls).They are receiving email stating they have used up his 3000minute and 1200minutes for calling planThey are able to make callsBut they cannot make call international numbersThey are on PSTN1 and PSTN 5 shows that we has available unit. Read More
Projects missing when using Project Online API
Good morning,
For a project, I need to get data from Project Online (PWA). For that purpose, I get the data by using http://<pwa_site>/_api/ProjectData/Projects but some projects are missing. I can see and edit the missing projects in the web app.
I tried multiples solutions found on internet (ODATA, Power Automate, …) but the result is never better than the current one.
I’ve compared missing project with the others project to understand why some of them are not present in the xml file but I didn’t find something relevant.
An other solution could be to automate an excel export of the projects.
Good morning, For a project, I need to get data from Project Online (PWA). For that purpose, I get the data by using http://<pwa_site>/_api/ProjectData/Projects but some projects are missing. I can see and edit the missing projects in the web app. I tried multiples solutions found on internet (ODATA, Power Automate, …) but the result is never better than the current one. I’ve compared missing project with the others project to understand why some of them are not present in the xml file but I didn’t find something relevant. An other solution could be to automate an excel export of the projects. Read More
I get error 65000 when I try to install a custom lockscreen on Windows
Recently tried to install a custom lockscreen on Windows 11 enterprise edition, gives error 65000. Does anyone know how to fix this?
Recently tried to install a custom lockscreen on Windows 11 enterprise edition, gives error 65000. Does anyone know how to fix this? Read More
New on Microsoft AppSource: July 1-7, 2024
We continue to expand the Microsoft AppSource ecosystem. For this volume, 159 new offers successfully met the onboarding criteria and went live. See details of the new offers below:
Get it now in our marketplace
AI Assistant: The empower AI Assistant integrates with PowerPoint, Word, and Outlook, providing pre-built prompts for effective communication. Define common communication tasks and create custom prompts for a personalized experience. The user-friendly interface makes it easy to use, even for those without prior AI experience.
Cascade: Cascade AI uses large language models to provide accurate HR support to employees. It streamlines engagement efforts and reduces HR support interactions, with significant cost savings. Cascade AI is scalable globally and can provide multi-language support for all enterprise-wide HR applications.
Conversation: AiWave Conversations is an innovative tool that uses conversational AI and generative AI to improve business interactions. It allows for the creation of AI assistants, data management, AI model development, and dialogue flow implementation. It manages both incoming and outgoing communication channels, transforming the way organizations manage communications and internal processes.
Core Capture connector for Microsoft Power Automate: OpenText’s connectors for Microsoft Power Automate integrate ECM capabilities with automation and workflow capabilities. Core Share enables content collaboration on documents and projects with anyone inside or outside an organization. Automate tasks such as storing email and synchronizing content with other file sharing platforms. Use any of the available 1000+ connectors to reduce integration efforts and costs. Easily connect any application to your business flows to increase the capture of information.
Crisp Retail Analytics: Real-Time, Actionable Insights for CPG Suppliers: Crisp is a retail data collaboration platform that aggregates, normalizes, and analyzes data from 30+ retailer and distributor partners. It offers an easy-to-use, interactive dashboard that provides actionable, daily insights for consumer goods teams across sales, supply chain, and category management. Crisp also integrates retail data from 40+ partners into the Microsoft Azure, Databricks, and Fabric.
Edge AI: Armada’s Edge AI suite offers apps for real-time decision making at the edge, supporting various industries such as health and safety, production optimization, and logistics. It caters to both commercial and public sectors.
Extra360: Extra360 is a platform that enhances customer engagement and loyalty through customer-centric promotions, integrated digital wallet solutions, data-driven decisions, omni-channel engagement, gamification techniques, scalability, and robust security. It offers API Studio for seamless integration and caters to a diverse range of sectors. The platform has been trusted and utilized by hundreds of brands and companies across industries, with demonstrable impact and effectiveness in the marketplace. Extra360 provides customized solutions to align with specific business needs.
Harmony Email & Collaboration Audit: Get a free audit to assess the level of risk and shadow IT in your organization. Increase visibility into cybersecurity incidents in Microsoft 365 and Google Workspace with this configurable audit service, analyzing data leaks, phishing, and access to SaaS services in just a few clicks.
Infosys TradeEdge – Order Orchestration: TradeEdge Order Orchestration enables enterprises to embrace the buy anywhere, fulfill anywhere, return anywhere model. It provides network-wide inventory access, splits and routes orders to one or more fulfillment partners based on inventory availability and proximity to customers, and automates end-to-end fulfillment processes across partners, sales channels, and internal systems. It creates an endless inventory aisle by leveraging partner inventory to fulfill customer and consumer orders.
Outcomes & Evaluation for Teams Townhall: This service provides comprehensive trend analysis for Teams Townhall events over six months. It evaluates audience engagement, infrastructure performance, and end-user experience to optimize live communication strategies and make informed investment decisions. Detailed reports on long-term trends, audience behavior, and infrastructure effectiveness are provided, along with actionable plans to enhance future events. Aimed at IT, network, event, and communications managers.
Packaging Waste Reporting: The Packaging Waste Reporting module helps companies comply with EU waste and packaging reporting legislation. It allows for easy setup of packaging materials and generates required statistics for reporting to authorities. The module can also be used for WEEE, battery, and textile reporting and can be installed in Microsoft Dynamics 365 Business Central. Streamline waste management and create a greener future.
Paillor: Paillor is an AI-powered employee support and automation platform that integrates all business systems in one place, simplifying work processes and increasing productivity. It efficiently handles a wide range of employee requests, leveraging advanced large language models and machine learning algorithms.
Polaris BSM – Business Swimlane Modeling: Polaris BSM helps companies create more efficient business processes. It allows users to display process steps digitally, analyze processes, and design them as a team. The software also calculates and compares key figures.
Teams Townhall Pre-Event Validation: This service offers IT and network managers pre-event testing and assessments to identify weaknesses in their video delivery chain. It provides detailed insights and recommendations for necessary improvements to ensure a robust technical foundation for successful Teams Townhall events. The event readiness analysis is customized to specific needs.
Teams Townhall Real-Time Support: This service offers real-time monitoring and support for Teams Townhall events, ensuring a smooth and secure experience. It provides access to a sophisticated monitoring system to detect and address issues during live events, preventing catastrophic failure. Additionally, users receive training on how to use real-time monitoring and mitigation systems, as well as in-depth post-event analysis and recommendations.
Teams Townhall Success Advisory: Get personalized technical consulting and success planning to implement Teams Townhall for strategic internal communications. This offer includes operational guidelines, an overview of capabilities, and discovery of primary use cases mapped to desired outcomes. Ideal for live event producers, high-impact business stakeholders, and IT managers.
Go further with workshops, proofs of concept, and implementations
AIM Cloud Migration Planning: Workshop: The AIM workshop helps businesses plan and implement their cloud migration, with experienced consultants analyzing their ERP environment and developing a customized roadmap. The workshop includes a pre-meeting, an analysis, and a results discussion. Benefits include expert knowledge, individual roadmap, modern technologies, attractive licensing offers, and reduced risk.
Bottling Accelerator: 18-Week Implementation: The OnActuate Bottling Accelerator helps beverage bottling organizations rapidly implement Microsoft Dynamics 365 Finance. It addresses inventory tracking, financial management, and sales and distribution challenges. The implementation process includes workshops, system configuration, design and development, key user training, and support.
Business Central Finance, Sales, Purchasing and Inventory: 9-Week Implementation (AU/NZ): BCPrise offers implementation of several Dynamics 365 Business Central modules. The process includes discovery and design, initial and advanced configuration, training and user acceptance testing, and go-live support. A full project plan with progress tracking is included.
Business Central Finance, Sales, Purchasing, and Payroll: 4-Month Implementation (AU/NZ): BCPrise offers implementation of Dynamics 365 Business Central and Keypay for SMBs. The process includes discovery and design, initial and advanced configuration, training and user acceptance testing, and go live preparation. A full project plan is included.
Business Central Manufacturing: 4-Month Implementation (AU/NZ): BCPrise offers implementation of Dynamics 365 Business Central for businesses with finance, sales, purchasing, inventory, and manufacturing modules. The implementation process includes discovery, design, configuration, training, and go-live support. A full project plan is included.
Business Central Projects: 4-Month Implementation (AU/NZ): BCPrise offers implementation of Dynamics 365 Business Central Finance, Sales, Purchasing, and Projects modules. The process includes discovery and design, initial and advanced configuration, training and UAT, and go-live preparation. A full project plan with progress tracking is included.
CRM on Dynamics 365 Sales: 2- to 4-Week Implementation: Available only in German, Abtis’s CRM Easy Start offers a comprehensive solution for implementing and optimizing your customer relationship management system. The service includes configuration, customization, and integration of standard tools such as SharePoint Online, Teams, and Outlook. It also provides mobile app deployment, user training, and email templates. The service is customized to meet the specific needs of your business.
Dynamics 365 & Experlogix CPQ: Implementation: Experlogix CPQ offers robust product and price configuration capabilities for sales teams, with a seamless product configurator experience within a quote or order. Sirocco provides vendor-agnostic advice, implementation, agility, and ongoing support for CPQ solutions.
Dynamics 365 Field Services: 4-Week Proof of Concept: Advaiya offers this service to demonstrate how Microsoft Dynamics 365 Field Services can improve your operations. The offer includes analysis, a customized pilot environment, and a live pilot simulation. Benefits include reduced maintenance costs and downtime, operational improvements, and a roadmap for implementation.
Empower Work with Microsoft Surface Devices and Intune: Implementation: Waves Computer offer empowers digital transformation by leveraging Surface devices and Intune for efficient device management, security, and seamless integration. The Surface portal provides insights and tools for IT administrators to manage devices, while enhancing the end-user experience.
ERP on Dynamics 365 Business Central: 2- to 4-Week Implementation: Abtis offers a simplified ERP implementation for small and medium-sized businesses. With pre-configured standard processes, businesses can easily digitize their sales, purchasing, and accounting. The system seamlessly integrates with other Microsoft tools and offers features such as inventory management and data management. This service is available only in German.
Intelligent Business Automation with the Power Platform: Implementation: Columbus Global’s Intelligent Business Automation offer guides businesses from idea to automated processes. It includes basic tech setup, envisioning and value mapping workshops, and design and build workshops. The service can be delivered globally both virtually and onsite, and involves business users, developers, and IT professionals. The result is a prioritized list of process automation use cases, guidance from experts, and insights into the platform’s capabilities.
Microsoft 365 Copilot Adoption: Workshop: Digital Attitude offers a smart and agile approach to help companies adopt Copilot for Microsoft 365. Their offering includes training and adoption workshops, experience labs, and measurement of adoption, experience, and attitude. The approach goes beyond promoting awareness and capabilities to stimulate lasting habits.
Microsoft Fabric: 2-Day Workshop: The Microsoft Fabric platform centralizes data management, offers AI-powered analytics, and seamlessly integrates with Microsoft 365. DataArt is offering a workshop to explore its features and suitability for businesses. The workshop is divided into two sessions, one for technical specialists and the other for executives. By the end of the workshop, attendees will gain a comprehensive understanding of Fabric and receive practical recommendations for integrating it into their operations.
NVISO Configuration and Support for Microsoft Purview: Implementation: Microsoft Purview enables data management, security, and governance, but proper configuration is crucial. NVISO offers support in designing, testing, and implementing Purview features, including sensitivity labels, retention policies, DLP policies, labeling and DLP automation, and custom policies. Deliverables include a reference architecture, implementation guideline, and operational manual.
RPA with Power Automate: 1-Day Workshop: Celebal Technologies offers this workshop for business experts and IT developers. The training equips participants with skills to automate repetitive tasks, digitize business processes, and optimize operations. The workshop covers RPA, Power Automate, and Power Automate Desktop, and includes hands-on experience, best practices, and industry use cases. Participants will collaboratively develop up to two real-world business scenarios and implement governance frameworks for scalability and compliance. The training provides a competitive edge, efficiency gains, and improved data insights.
SPA (Sales & Process Acceleration): Implementation: SPA is a proposal generation automation solution that uses tools from the Microsoft Power Platform and Azure AI Studio to optimize your sales team’s time, increase productivity and generate more sales results. The solution addresses challenges such as understanding customer needs, time management, low conversion, product complexity, accuracy of proposal information and licensing and rule changes. The solution offers benefits such as greater efficiency, reduction of human errors, dynamic customization, better customer service, increased success rate in proposals, time savings in manual adjustment, continuous process improvement, understanding deeper understanding of the success of proposals and the ability to quickly adapt to market changes. N1 Software’s implementation includes mapping processes and actions for creating proposals, identifying and organizing licensing rules and manufacturer products, entering values, defining standard payment terms, and more. This offer is available in Portuguese for Brazil.
Contact our partners
Adoption Attendant for Copilot for Microsoft 365: 3-Month Assessment”
Amazon Ads to Azure SQL Connector
Amazon Seller Integration for Dynamics 365 Business Central
Application Packaging as a Service
Application Remediation with Windows 11 Readiness
ARQEBI for Portuguese Localization
Artware LATAM Venezuelan Localization
Artware Service Contract Currency
Ask Peter – AI Recruiting Copilot
Attachments on Azure Blob Storage
AutoRecruit eRecruitment Portal
Barley Trellis Plot by Office Solution
Center of Excellence for Microsoft 365 Copilot
COGLAS Modern Warehouse Management System
Copilot for Microsoft 365 Readiness: 2-Day Workshop
Copilot for Microsoft 365: Workshop
Distri Single Logistics Multi Finance
DKS 365 Project and Supply Operations
Dynamics 365 Field Service: 1-Week Assessment
Enforced Digital Vouchers (DK)
EnGage- Smart ESG with ISO Monitoring and Reporting
EVENT- Seminar and Event Management
Exopen Financial Reports Template App
ForNav Print Connector for Agriware 365
HCLTech’s Advantage Migrate Integrated with Microsoft Fabric
Interactive Dashboards with Sprucely.io
Manage Pigeonhole for PowerPoint
McFile for Microsoft 365 Office Apps
Mercurius Construction Industry Scheme
Microsoft Cybersecurity: 5-Week Assessment
Microsoft Fabric: 1-Week Assessment and Implementation
Persistent Connected Copilot Platform
Print Agent Connector for Agriware 365
Qore – Queue Management System
Re-imagining Infrastructure Management – Converged Cloud
Rivastor: Transforming Brand Perception with AI Insights
SharePoint Health Check: 12-Week Assessment
Special Attack Store Manager Cloud Pro
Subsalt Query Engine for Regulated Data
Velosio Pay Advanced Credit Cards for Business Central
Voronoi Diagram by Office Solution
Wisefish Warehouse & Logistics Insights
This content was generated by Microsoft Azure OpenAI and then revised by human editors.
Microsoft Tech Community – Latest Blogs –Read More
Adding standard deviation as a bar to a scatter plot
Hello all, I’m plotting weather data and want to show the mean, standard deviation and min-max values in one plot. I’ve attached a photo of the ideal end result. How might I go about it using the data below as an example?
Mean_Temp_1 = [12]
Mean_Temp_2 = [15]
Mean_Temp_3 = [11]
SD_1 = [1.2]
SD_2 = [0.8]
SD_3 = [1.4]
Max_1 = [14]
Max_2 = [17]
Max_3 = [12]
Min_1 = [10]
Min_2 = [12]
Min_3 = [10]Hello all, I’m plotting weather data and want to show the mean, standard deviation and min-max values in one plot. I’ve attached a photo of the ideal end result. How might I go about it using the data below as an example?
Mean_Temp_1 = [12]
Mean_Temp_2 = [15]
Mean_Temp_3 = [11]
SD_1 = [1.2]
SD_2 = [0.8]
SD_3 = [1.4]
Max_1 = [14]
Max_2 = [17]
Max_3 = [12]
Min_1 = [10]
Min_2 = [12]
Min_3 = [10] Hello all, I’m plotting weather data and want to show the mean, standard deviation and min-max values in one plot. I’ve attached a photo of the ideal end result. How might I go about it using the data below as an example?
Mean_Temp_1 = [12]
Mean_Temp_2 = [15]
Mean_Temp_3 = [11]
SD_1 = [1.2]
SD_2 = [0.8]
SD_3 = [1.4]
Max_1 = [14]
Max_2 = [17]
Max_3 = [12]
Min_1 = [10]
Min_2 = [12]
Min_3 = [10] scatter MATLAB Answers — New Questions
Curve Fitting complex data (x,y) for constant extraction.
Hello,
I’ve been following the following link — https://www.mathworks.com/help/optim/ug/fit-model-to-complex-data.html#
to try and extract the real constants (N_s,Tau_s, and c) from the Drude-Smith derivation for complex conductivity. This involves fitting both the real and imaginary components (which may be the problem in itself, since the example fits regular data with complex noise?)
I’ve attempted both lsqnonlin and lsqcurve fit methods.
file =[‘DSfit_Sitest.xls’]; %%file attached
input = xlsread(file);
x = input(:,1); %%%% xdata, freqency, omega, real numbers from (0.2-1.4 THz)
R = input(:,2); %%%% Real component (blue in plot)
I = input(:,3);%%%% Imaginary component (orange in plot)
ydata = complex(R,I); %%%% complex conductivity, sigma_s
q = 1.602E-19; %% charge
m = 0.98; %% effective electron mass
mi = 1/0.98; %% inverse electron mass used to make typing the equation simpler
objfcn = @(C)(((C(1)*(q^2)*mi*C(2))./(1-1i.*x.*C(2))).*(1+(C(3)./(1-1i.*x.*C(2))))) – ydata;
opts = optimoptions(@lsqnonlin,’Display’,’off’);
x0=[1e17, 100, -0.1]; %% initial guesses, I expect these to be reasonable values
LB = [1e15, 1, -1]; %%Typical carrier concentrations (cm-3), Tau_s (C(2)) units in picoseconds, -1<c<0
UB = [1e21, 1000, 0];
[const,~,residual,exitflag,output] = lsqnonlin(objfcn,x0,[],[],opts); %% does not run with LB and UB, so i leave blank.
This method outputs the initial guesses, and when I use the initial guesses to plot the outputs I get my data graph flipped, meaning my function just equals zero.
Using lsqcurvefit
objfcn = @(C,x)(((C(1)*(q^2).*mi.*C(2))./(1-1i.*x.*C(2))).*(1+(C(3)./(1-1i.*x.*C(2)))));
opts = optimoptions(@lsqcurvefit,opts);
x0=[1e17, 100, -0.1];
LB = [1e15, 1, -1];
UB = [1e21, 1e3, 0];
[constan,resnorm] = lsqcurvefit(objfcn,x0,x,ydata,[],[],opts)
I get the error "not enough input arguments" in my objfcn, and it still outputs the initial guesses
Any help with why this isnt working or if im doing something really wrong is greatly appreciated! I am a novice Matlab user.
Thank you!!Hello,
I’ve been following the following link — https://www.mathworks.com/help/optim/ug/fit-model-to-complex-data.html#
to try and extract the real constants (N_s,Tau_s, and c) from the Drude-Smith derivation for complex conductivity. This involves fitting both the real and imaginary components (which may be the problem in itself, since the example fits regular data with complex noise?)
I’ve attempted both lsqnonlin and lsqcurve fit methods.
file =[‘DSfit_Sitest.xls’]; %%file attached
input = xlsread(file);
x = input(:,1); %%%% xdata, freqency, omega, real numbers from (0.2-1.4 THz)
R = input(:,2); %%%% Real component (blue in plot)
I = input(:,3);%%%% Imaginary component (orange in plot)
ydata = complex(R,I); %%%% complex conductivity, sigma_s
q = 1.602E-19; %% charge
m = 0.98; %% effective electron mass
mi = 1/0.98; %% inverse electron mass used to make typing the equation simpler
objfcn = @(C)(((C(1)*(q^2)*mi*C(2))./(1-1i.*x.*C(2))).*(1+(C(3)./(1-1i.*x.*C(2))))) – ydata;
opts = optimoptions(@lsqnonlin,’Display’,’off’);
x0=[1e17, 100, -0.1]; %% initial guesses, I expect these to be reasonable values
LB = [1e15, 1, -1]; %%Typical carrier concentrations (cm-3), Tau_s (C(2)) units in picoseconds, -1<c<0
UB = [1e21, 1000, 0];
[const,~,residual,exitflag,output] = lsqnonlin(objfcn,x0,[],[],opts); %% does not run with LB and UB, so i leave blank.
This method outputs the initial guesses, and when I use the initial guesses to plot the outputs I get my data graph flipped, meaning my function just equals zero.
Using lsqcurvefit
objfcn = @(C,x)(((C(1)*(q^2).*mi.*C(2))./(1-1i.*x.*C(2))).*(1+(C(3)./(1-1i.*x.*C(2)))));
opts = optimoptions(@lsqcurvefit,opts);
x0=[1e17, 100, -0.1];
LB = [1e15, 1, -1];
UB = [1e21, 1e3, 0];
[constan,resnorm] = lsqcurvefit(objfcn,x0,x,ydata,[],[],opts)
I get the error "not enough input arguments" in my objfcn, and it still outputs the initial guesses
Any help with why this isnt working or if im doing something really wrong is greatly appreciated! I am a novice Matlab user.
Thank you!! Hello,
I’ve been following the following link — https://www.mathworks.com/help/optim/ug/fit-model-to-complex-data.html#
to try and extract the real constants (N_s,Tau_s, and c) from the Drude-Smith derivation for complex conductivity. This involves fitting both the real and imaginary components (which may be the problem in itself, since the example fits regular data with complex noise?)
I’ve attempted both lsqnonlin and lsqcurve fit methods.
file =[‘DSfit_Sitest.xls’]; %%file attached
input = xlsread(file);
x = input(:,1); %%%% xdata, freqency, omega, real numbers from (0.2-1.4 THz)
R = input(:,2); %%%% Real component (blue in plot)
I = input(:,3);%%%% Imaginary component (orange in plot)
ydata = complex(R,I); %%%% complex conductivity, sigma_s
q = 1.602E-19; %% charge
m = 0.98; %% effective electron mass
mi = 1/0.98; %% inverse electron mass used to make typing the equation simpler
objfcn = @(C)(((C(1)*(q^2)*mi*C(2))./(1-1i.*x.*C(2))).*(1+(C(3)./(1-1i.*x.*C(2))))) – ydata;
opts = optimoptions(@lsqnonlin,’Display’,’off’);
x0=[1e17, 100, -0.1]; %% initial guesses, I expect these to be reasonable values
LB = [1e15, 1, -1]; %%Typical carrier concentrations (cm-3), Tau_s (C(2)) units in picoseconds, -1<c<0
UB = [1e21, 1000, 0];
[const,~,residual,exitflag,output] = lsqnonlin(objfcn,x0,[],[],opts); %% does not run with LB and UB, so i leave blank.
This method outputs the initial guesses, and when I use the initial guesses to plot the outputs I get my data graph flipped, meaning my function just equals zero.
Using lsqcurvefit
objfcn = @(C,x)(((C(1)*(q^2).*mi.*C(2))./(1-1i.*x.*C(2))).*(1+(C(3)./(1-1i.*x.*C(2)))));
opts = optimoptions(@lsqcurvefit,opts);
x0=[1e17, 100, -0.1];
LB = [1e15, 1, -1];
UB = [1e21, 1e3, 0];
[constan,resnorm] = lsqcurvefit(objfcn,x0,x,ydata,[],[],opts)
I get the error "not enough input arguments" in my objfcn, and it still outputs the initial guesses
Any help with why this isnt working or if im doing something really wrong is greatly appreciated! I am a novice Matlab user.
Thank you!! complex curve fitting, curvefitting, lsqcurvefit, lsqnonlin, complex data, drude-smith MATLAB Answers — New Questions
Is it possible to ADD a warning before Matlab starts?
So, I have the previously-reported issue that, on startup in Windows 10, Matlab reports that any folders that are on mapped network drives (Z:, Y: etc.) are "nonexistent or not a directory". I also lose any scripts or functions from those mapped folders that were open in the editor when Matlab was last shut down, so I have to find and re-open them.
The hack to get around this is to access the network drive(s) in Microsoft Windows Explorer/File Explorer, after which Matlab can see the folders in those drives – e.g. if functions or scripts were loaded into the editor, these will appear following the above hack.
What I’d like is a warning, before Matlab goes off and fails to find those mapped network drives, reminding me to open the offending drives in Windows Explorer before continuing.
Is there any way to do this via startup.m – or would it need a Windows batch file to incorporate the warning and the pause?So, I have the previously-reported issue that, on startup in Windows 10, Matlab reports that any folders that are on mapped network drives (Z:, Y: etc.) are "nonexistent or not a directory". I also lose any scripts or functions from those mapped folders that were open in the editor when Matlab was last shut down, so I have to find and re-open them.
The hack to get around this is to access the network drive(s) in Microsoft Windows Explorer/File Explorer, after which Matlab can see the folders in those drives – e.g. if functions or scripts were loaded into the editor, these will appear following the above hack.
What I’d like is a warning, before Matlab goes off and fails to find those mapped network drives, reminding me to open the offending drives in Windows Explorer before continuing.
Is there any way to do this via startup.m – or would it need a Windows batch file to incorporate the warning and the pause? So, I have the previously-reported issue that, on startup in Windows 10, Matlab reports that any folders that are on mapped network drives (Z:, Y: etc.) are "nonexistent or not a directory". I also lose any scripts or functions from those mapped folders that were open in the editor when Matlab was last shut down, so I have to find and re-open them.
The hack to get around this is to access the network drive(s) in Microsoft Windows Explorer/File Explorer, after which Matlab can see the folders in those drives – e.g. if functions or scripts were loaded into the editor, these will appear following the above hack.
What I’d like is a warning, before Matlab goes off and fails to find those mapped network drives, reminding me to open the offending drives in Windows Explorer before continuing.
Is there any way to do this via startup.m – or would it need a Windows batch file to incorporate the warning and the pause? startup, network issues, windows MATLAB Answers — New Questions
Registering an email address
Hello,
I have a problem putting a new address (professional) in Outlook.
After more than 45 minutes with the hotline, no solution was found.
Whether it is on the application or on the web (public or private), I get an error message.
My IT dept tells me it should work and sent me the technical details.
Could somenone help with this plesase ?
Thanks a lot.
Thomas
Hello,I have a problem putting a new address (professional) in Outlook.After more than 45 minutes with the hotline, no solution was found.Whether it is on the application or on the web (public or private), I get an error message. My IT dept tells me it should work and sent me the technical details. Could somenone help with this plesase ? Thanks a lot.Thomas Read More
How To Money Refund Cred
मीशो की ग्राहक सेवा टीम या तो फोन, 096648 47919. ईमेल, या उनकी वेबसाइट के ग्राहक सहायता पोर्टल के माध्यम से। 080164–56551., लिखित शिकायत दर्ज करें: अपनी मौखिक शिकायत के बाद लिखित शिकायत दर्ज करें।
मीशो की ग्राहक सेवा टीम या तो फोन, 096648 47919. ईमेल, या उनकी वेबसाइट के ग्राहक सहायता पोर्टल के माध्यम से। 080164–56551., लिखित शिकायत दर्ज करें: अपनी मौखिक शिकायत के बाद लिखित शिकायत दर्ज करें। Read More
Does AI Notes work with external meeting participants that don’t have Teams Premium?
Hi, I couldn’t find this anywhere: if I have Teams Premium as the meeting organizer, and I invite only external particpants who themselves don’t have a Teams Premium subscription, does the AI Notes feature work?
I read some articles that said Live Translated Transcriptions only require the organizer to have Premium, but couldn’t find the same regarding AI Notes.
Hi, I couldn’t find this anywhere: if I have Teams Premium as the meeting organizer, and I invite only external particpants who themselves don’t have a Teams Premium subscription, does the AI Notes feature work? I read some articles that said Live Translated Transcriptions only require the organizer to have Premium, but couldn’t find the same regarding AI Notes. Read More
External Sharing
Dear Community,
We have a business requirement that internal staff needs to collaborate files with external customers.
Staff share individual files from OneDrive for Business or SharePoint Online library.External customers will be required to register as guests.External customers will be required to use MFA for authentication.
I am able to get it somewhat working by enabling OneDrive/SharePoint and Azure B2B integration.
The benefit is that external customers will be added as guests even when you share single files, which is not possible by default.
Then the default guest CAP will require guests to have MFA turned on during first registration.
The reason I said somewhat working is that the user experience is not that great.
For example, the page for guest registration cannot be customised so the process seems clunky and confusing for non-technical user, so as the guest registration email.
The SharePoint file sharing email that customers receive are also not customisable. It looks like a spam.
It seems like without using Azure B2C or now the next generation of External ID, I cannot use separate company branding just for my guests.
When comparing different features, it also comes to my understanding that even with an external tenant, the customised signup/signin user flow needs to associated with an enterprise app. And this document specifically called out OneDrive/SharePoint cannot be used to trigger the signup/signin user flow.
https://learn.microsoft.com/en-us/entra/external-id/self-service-sign-up-user-flow
The above link is for B2B but I think for B2C, it is the same deal, even though it didn’t say explicitly.
Any advice is welcome.
Thank you so much!
nhtkid
Dear Community, We have a business requirement that internal staff needs to collaborate files with external customers.Staff share individual files from OneDrive for Business or SharePoint Online library.External customers will be required to register as guests.External customers will be required to use MFA for authentication.I am able to get it somewhat working by enabling OneDrive/SharePoint and Azure B2B integration.The benefit is that external customers will be added as guests even when you share single files, which is not possible by default.Then the default guest CAP will require guests to have MFA turned on during first registration. The reason I said somewhat working is that the user experience is not that great.For example, the page for guest registration cannot be customised so the process seems clunky and confusing for non-technical user, so as the guest registration email.The SharePoint file sharing email that customers receive are also not customisable. It looks like a spam. It seems like without using Azure B2C or now the next generation of External ID, I cannot use separate company branding just for my guests. When comparing different features, it also comes to my understanding that even with an external tenant, the customised signup/signin user flow needs to associated with an enterprise app. And this document specifically called out OneDrive/SharePoint cannot be used to trigger the signup/signin user flow. https://learn.microsoft.com/en-us/entra/external-id/self-service-sign-up-user-flowThe above link is for B2B but I think for B2C, it is the same deal, even though it didn’t say explicitly.https://learn.microsoft.com/en-us/entra/external-id/customers/how-to-user-flow-sign-up-sign-in-customers Any advice is welcome.Thank you so much!nhtkid Read More
Azure B2B, B2C or Entra External ID for OneDrive/SharePoint external collaboration
Dear Community,
We have a business requirement that internal staff needs to collaborate files with external customers.
Staff share individual files from OneDrive for Business or SharePoint Online library.External customers will be required to register as guests.External customers will be required to use MFA for authentication.
I am able to get it somewhat working by enabling OneDrive/SharePoint and Azure B2B integration.
The benefit is that external customers will be added as guests even when you share single files, which is not possible by default.
Then the default guest CAP will require guests to have MFA turned on during first registration.
The reason I said somewhat working is that the user experience is not that great.
For example, the page for guest registration cannot be customised so the process seems clunky and confusing for non-technical user, so as the guest registration email.
The SharePoint file sharing email that customers receive are also not customisable. It looks like a spam.
It seems like without using Azure B2C or now the next generation of External ID, I cannot use separate company branding just for my guests.
When comparing different features, it also comes to my understanding that even with an external tenant, the customised signup/signin user flow needs to associated with an enterprise app. And this document specifically called out OneDrive/SharePoint cannot be used to trigger the signup/signin user flow.
https://learn.microsoft.com/en-us/entra/external-id/self-service-sign-up-user-flow
The above link is for B2B but I think for B2C, it is the same deal, even though it didn’t say explicitly.
Any advice is welcome.
Thank you so much!
nhtkid
Dear Community, We have a business requirement that internal staff needs to collaborate files with external customers.Staff share individual files from OneDrive for Business or SharePoint Online library.External customers will be required to register as guests.External customers will be required to use MFA for authentication.I am able to get it somewhat working by enabling OneDrive/SharePoint and Azure B2B integration.The benefit is that external customers will be added as guests even when you share single files, which is not possible by default.Then the default guest CAP will require guests to have MFA turned on during first registration. The reason I said somewhat working is that the user experience is not that great.For example, the page for guest registration cannot be customised so the process seems clunky and confusing for non-technical user, so as the guest registration email.The SharePoint file sharing email that customers receive are also not customisable. It looks like a spam. It seems like without using Azure B2C or now the next generation of External ID, I cannot use separate company branding just for my guests. When comparing different features, it also comes to my understanding that even with an external tenant, the customised signup/signin user flow needs to associated with an enterprise app. And this document specifically called out OneDrive/SharePoint cannot be used to trigger the signup/signin user flow. https://learn.microsoft.com/en-us/entra/external-id/self-service-sign-up-user-flowThe above link is for B2B but I think for B2C, it is the same deal, even though it didn’t say explicitly.https://learn.microsoft.com/en-us/entra/external-id/customers/how-to-user-flow-sign-up-sign-in-customers Any advice is welcome.Thank you so much!nhtkid Read More
क्रेड की ग्राहक सेवा टीम से शिकायत दर्ज करें:
क्रेड की ग्राहक सेवा टीम या तो फोन, 096648-47919. ईमेल, या उनकी वेबसाइट के ग्राहक सहायता पोर्टल के माध्यम से। 080164–56551., लिखित शिकायत दर्ज करें: अपनी मौखिक शिकायत के बाद लिखित शिकायत दर्ज करें।
क्रेड की ग्राहक सेवा टीम या तो फोन, 096648-47919. ईमेल, या उनकी वेबसाइट के ग्राहक सहायता पोर्टल के माध्यम से। 080164–56551., लिखित शिकायत दर्ज करें: अपनी मौखिक शिकायत के बाद लिखित शिकायत दर्ज करें। Read More
We have a customer that has gone into administration (Chapter 11) – will Microsoft offer any flex?
I knew this was likely to happen eventually -and we did raise it as an issue when NCE was first launched, but Microsoft seem to be the only provider in the world (compared to Cisco, Crowdstrike etc) who don’t allow partners ANY flexibility to move/re-user licenses elsewhere, and we just have to “suck it up”.
We have a customer that has unfortunately recently gone into administration in the UK. This leaves us with a large liability of licenses until February 2025. We were hoping that we could get some flexibility and move these licenses to Monthly/Monthly to allow us to reduce the seats.
All we had was the standard response from Microsoft. Surely they need to address this otherwise they will potentially put some partners out of business – which cannot be good for anyone
I knew this was likely to happen eventually -and we did raise it as an issue when NCE was first launched, but Microsoft seem to be the only provider in the world (compared to Cisco, Crowdstrike etc) who don’t allow partners ANY flexibility to move/re-user licenses elsewhere, and we just have to “suck it up”. We have a customer that has unfortunately recently gone into administration in the UK. This leaves us with a large liability of licenses until February 2025. We were hoping that we could get some flexibility and move these licenses to Monthly/Monthly to allow us to reduce the seats. All we had was the standard response from Microsoft. Surely they need to address this otherwise they will potentially put some partners out of business – which cannot be good for anyone Read More
Special appfolder is sometimes named Graph
Expected or Desired Behavior
According to the documentation at https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_get_specialfolder the special appfolder should be named /Apps/{Application Name}
Observed Behavior
For some users the appfolder is named /Apps/Graph even though the app name is not Graph.
For users with the appfolder named Graph the create subscription request fails. The create subscription request for the resource /me/drive/special/approot fails with 503 and the message [Status Code: ServiceUnavailable; Reason: User content migrated. Cannot access disabled item.]
Steps to Reproduce
This happens for some of our users, but not all. I have been able to reproduce it on one onedrive-user that i have personal access to.
Does anyone have any idea how to resolve this? OneDrive is unusable for 50% of our users at the moment.
Expected or Desired BehaviorAccording to the documentation at https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_get_specialfolder the special appfolder should be named /Apps/{Application Name} Observed BehaviorFor some users the appfolder is named /Apps/Graph even though the app name is not Graph. For users with the appfolder named Graph the create subscription request fails. The create subscription request for the resource /me/drive/special/approot fails with 503 and the message [Status Code: ServiceUnavailable; Reason: User content migrated. Cannot access disabled item.] Steps to ReproduceThis happens for some of our users, but not all. I have been able to reproduce it on one onedrive-user that i have personal access to. Does anyone have any idea how to resolve this? OneDrive is unusable for 50% of our users at the moment. Read More
SharePoint base url changes for some users
Hi All,
We have a SharePoint site :
https://mydev.sharepoint.com/sites/Intranet
When certain users access this, on the browser the url remains the same but when few users access the same url the base url gets updated to
https://mydev.sharepoint.com.mcas.ms/sites/Intranet
Please can you let me know what could be the reason for this and what settings need to be updated for the user so they land on the same earlier url
Thanks
Hi All, We have a SharePoint site : https://mydev.sharepoint.com/sites/Intranet When certain users access this, on the browser the url remains the same but when few users access the same url the base url gets updated to https://mydev.sharepoint.com.mcas.ms/sites/Intranet Please can you let me know what could be the reason for this and what settings need to be updated for the user so they land on the same earlier urlThanks Read More
Find the intersection points between two data sets
If I have two data sets(each from xy data) and they are intersect at more than two points, How can I find the area between intersection points? If there are more than one area, i.e., Area1, Area2, etc, I would like to find each area separately and assign +ve and -ve sign to the areas? Figure and Example of my data is below (data1 and data2):
data1 = [575721.678739338 3189196.15577354
575711.702452018 3189195.13447944
575701.688569224 3189195.60208872
575691.697320475 3189195.17336187
575681.678990798 3189195.81713592
575676.797287407 3189195.96672958
575671.667154953 3189196.20376653
575661.619557374 3189198.00667871
575651.499830521 3189202.66611234
575645.227659483 3189205.17163764
575641.392720288 3189206.82592006
575637.150456055 3189214.96975033
575633.985427757 3189224.89189997
575630.732860735 3189232.87583130
575629.825200565 3189234.78891918
575626.268606140 3189244.70118035
575625.055756129 3189254.67262378
575624.048800203 3189264.64926620
575626.033070719 3189274.70144150
575628.301047757 3189284.76078116
575629.348139014 3189287.71323321
575630.865563282 3189294.82760927
575632.585061618 3189304.87309963
575633.749353391 3189314.90457031
575634.569486755 3189324.92735054
575636.649511930 3189334.98194565
575638.050011320 3189339.20256643
575640.817786629 3189345.08927361
575647.656595518 3189354.86415159
575647.870775185 3189355.26944727
575654.747228098 3189365.44516408
575657.269399466 3189370.27939153
575662.074406641 3189375.63226375
575667.058357271 3189378.71883487
575674.871973717 3189385.95750447
575676.800091128 3189389.02837035
575684.133094564 3189396.19344337
575686.586685119 3189397.56143505
575696.422894795 3189404.12972127
575700.864844918 3189406.61803541
575706.247405814 3189411.16129194
575715.751567506 3189416.99603830
575716.098781051 3189417.12905527
575726.036514414 3189419.67706070
575736.017098070 3189420.52822388
575745.982395609 3189421.98474492
575756.005774219 3189421.14128728
575766.053610679 3189419.32932771
575769.136073507 3189418.34413225
575776.223506655 3189412.68383576
575779.240944960 3189408.59722472
575786.447078405 3189403.91279079
575796.523744120 3189400.95926314
575799.389111391 3189399.10393297
575805.535189846 3189389.25705318
575806.854089989 3189387.95995545
575816.972618517 3189383.34868686
575819.537289559 3189379.60855471
575822.008081040 3189369.66886365
575827.547621183 3189360.66081291
575828.761131424 3189359.83730830
575836.931299811 3189350.04153712
575837.844535516 3189348.98535223
575840.943246114 3189340.14076154
575843.602853864 3189330.20583632
575846.984577107 3189320.28914546
575848.756275143 3189312.96214604
575850.522840530 3189310.37640707
575854.053180112 3189300.46346810
575854.964811253 3189290.48440209
575851.181415037 3189280.38677937
575849.764141289 3189273.04921042
575849.517599011 3189270.34267971
575843.653125281 3189260.19250792
575840.207154651 3189255.42251920
575835.594666340 3189249.98693602
575830.470162708 3189244.92434067
575823.627599270 3189239.68266813
575820.649830226 3189237.72661781
575810.781232117 3189232.44033033
575805.255617650 3189229.21667049
575800.963379230 3189225.14444292
575791.086532261 3189220.18486820
575787.656625601 3189218.77019437
575781.182921444 3189216.28522513
575771.266091576 3189212.90911181
575761.354718952 3189209.31690449
575758.250526886 3189208.02557942
575751.503530051 3189203.34130216
575741.563262126 3189200.89346790
575731.630100857 3189198.16421964
575727.023285731 3189197.23498323
575721.678739338 3189196.15577354]
data2 = [575731.422838196 3189206.37232435
575724.697961952 3189207.17834314
575721.394010027 3189207.43174664
575711.364654134 3189208.51209622
575701.337970259 3189209.48665581
575691.319597425 3189210.13210704
575681.265867243 3189212.17781946
575671.229649118 3189213.53004162
575661.238791658 3189213.08590592
575651.213949200 3189213.98768238
575647.113409301 3189215.22132567
575640.991573607 3189222.71223818
575639.486204725 3189225.03080093
575630.773146661 3189231.28042522
575626.361206512 3189234.70144909
575620.515832815 3189241.38861678
575619.227201771 3189244.52337575
575615.294804439 3189254.42614638
575611.728754337 3189264.33816728
575610.825894415 3189274.31743727
575610.019497925 3189284.29914302
575612.199764593 3189294.35626689
575614.140766277 3189304.40734924
575616.755327358 3189314.47544050
575618.552527076 3189319.13850901
575621.878551158 3189324.60688061
575628.162248551 3189334.67588513
575628.217729738 3189334.76902672
575635.418719721 3189344.95293626
575637.762350507 3189350.59416235
575640.873491159 3189355.09275120
575647.522419377 3189360.17761406
575652.554788934 3189365.38980024
575657.207443596 3189372.73287452
575660.346312788 3189375.58862551
575667.041781573 3189379.37523935
575673.376126510 3189385.91973087
575676.723934510 3189392.04419395
575680.359244947 3189396.09814467
575686.526280383 3189399.95347416
575693.260598684 3189406.42600951
575696.245920828 3189411.13790683
575701.943322200 3189416.64734516
575706.050815019 3189418.94628958
575715.930434190 3189423.79558285
575723.484025899 3189427.19337957
575725.793998076 3189429.28068546
575735.775124065 3189430.11037054
575745.755309984 3189430.97731069
575750.945388100 3189427.88685048
575755.879236329 3189426.15217806
575765.956578764 3189423.17178706
575776.025683486 3189420.51763495
575779.517405427 3189418.60628718
575785.884931838 3189408.76500175
575786.332681882 3189408.44290783
575796.433874881 3189404.51810025
575806.560091648 3189399.60237019
575808.088283081 3189399.32360785
575816.676357286 3189395.08072864
575819.981180111 3189389.62184792
575826.994371634 3189382.56978788
575832.212012345 3189379.92861994
575837.242777695 3189372.81535473
575838.008516413 3189370.07290944
575840.812110902 3189360.14162087
575842.594128381 3189350.18453504
575847.474455532 3189340.30568737
575848.111345114 3189338.50205485
575854.967611222 3189330.49281788
575855.989375110 3189320.51653295
575857.810750377 3189310.56043949
575854.671003314 3189300.47906917
575852.328243476 3189290.41782454
575849.406644524 3189287.20664394
575845.929355550 3189280.25415686
575841.477934729 3189270.13966651
575839.935268430 3189266.18969967
575834.930938952 3189259.97226068
575830.172676589 3189256.70535602
575823.102617400 3189249.67149545
575820.455440295 3189245.42484822
575813.145830725 3189239.41799054
575810.633609741 3189238.28648202
575800.759767900 3189233.20788699
575791.729334709 3189228.87511614
575790.885959615 3189228.12798485
575781.089451899 3189219.98683027
575777.562658171 3189218.51531071
575771.160574863 3189217.08781557
575761.222464867 3189214.55447377
575751.293622469 3189211.65414062
575741.345269581 3189209.52649525
575734.009662553 3189207.41347302
575731.422838196 3189206.37232435]If I have two data sets(each from xy data) and they are intersect at more than two points, How can I find the area between intersection points? If there are more than one area, i.e., Area1, Area2, etc, I would like to find each area separately and assign +ve and -ve sign to the areas? Figure and Example of my data is below (data1 and data2):
data1 = [575721.678739338 3189196.15577354
575711.702452018 3189195.13447944
575701.688569224 3189195.60208872
575691.697320475 3189195.17336187
575681.678990798 3189195.81713592
575676.797287407 3189195.96672958
575671.667154953 3189196.20376653
575661.619557374 3189198.00667871
575651.499830521 3189202.66611234
575645.227659483 3189205.17163764
575641.392720288 3189206.82592006
575637.150456055 3189214.96975033
575633.985427757 3189224.89189997
575630.732860735 3189232.87583130
575629.825200565 3189234.78891918
575626.268606140 3189244.70118035
575625.055756129 3189254.67262378
575624.048800203 3189264.64926620
575626.033070719 3189274.70144150
575628.301047757 3189284.76078116
575629.348139014 3189287.71323321
575630.865563282 3189294.82760927
575632.585061618 3189304.87309963
575633.749353391 3189314.90457031
575634.569486755 3189324.92735054
575636.649511930 3189334.98194565
575638.050011320 3189339.20256643
575640.817786629 3189345.08927361
575647.656595518 3189354.86415159
575647.870775185 3189355.26944727
575654.747228098 3189365.44516408
575657.269399466 3189370.27939153
575662.074406641 3189375.63226375
575667.058357271 3189378.71883487
575674.871973717 3189385.95750447
575676.800091128 3189389.02837035
575684.133094564 3189396.19344337
575686.586685119 3189397.56143505
575696.422894795 3189404.12972127
575700.864844918 3189406.61803541
575706.247405814 3189411.16129194
575715.751567506 3189416.99603830
575716.098781051 3189417.12905527
575726.036514414 3189419.67706070
575736.017098070 3189420.52822388
575745.982395609 3189421.98474492
575756.005774219 3189421.14128728
575766.053610679 3189419.32932771
575769.136073507 3189418.34413225
575776.223506655 3189412.68383576
575779.240944960 3189408.59722472
575786.447078405 3189403.91279079
575796.523744120 3189400.95926314
575799.389111391 3189399.10393297
575805.535189846 3189389.25705318
575806.854089989 3189387.95995545
575816.972618517 3189383.34868686
575819.537289559 3189379.60855471
575822.008081040 3189369.66886365
575827.547621183 3189360.66081291
575828.761131424 3189359.83730830
575836.931299811 3189350.04153712
575837.844535516 3189348.98535223
575840.943246114 3189340.14076154
575843.602853864 3189330.20583632
575846.984577107 3189320.28914546
575848.756275143 3189312.96214604
575850.522840530 3189310.37640707
575854.053180112 3189300.46346810
575854.964811253 3189290.48440209
575851.181415037 3189280.38677937
575849.764141289 3189273.04921042
575849.517599011 3189270.34267971
575843.653125281 3189260.19250792
575840.207154651 3189255.42251920
575835.594666340 3189249.98693602
575830.470162708 3189244.92434067
575823.627599270 3189239.68266813
575820.649830226 3189237.72661781
575810.781232117 3189232.44033033
575805.255617650 3189229.21667049
575800.963379230 3189225.14444292
575791.086532261 3189220.18486820
575787.656625601 3189218.77019437
575781.182921444 3189216.28522513
575771.266091576 3189212.90911181
575761.354718952 3189209.31690449
575758.250526886 3189208.02557942
575751.503530051 3189203.34130216
575741.563262126 3189200.89346790
575731.630100857 3189198.16421964
575727.023285731 3189197.23498323
575721.678739338 3189196.15577354]
data2 = [575731.422838196 3189206.37232435
575724.697961952 3189207.17834314
575721.394010027 3189207.43174664
575711.364654134 3189208.51209622
575701.337970259 3189209.48665581
575691.319597425 3189210.13210704
575681.265867243 3189212.17781946
575671.229649118 3189213.53004162
575661.238791658 3189213.08590592
575651.213949200 3189213.98768238
575647.113409301 3189215.22132567
575640.991573607 3189222.71223818
575639.486204725 3189225.03080093
575630.773146661 3189231.28042522
575626.361206512 3189234.70144909
575620.515832815 3189241.38861678
575619.227201771 3189244.52337575
575615.294804439 3189254.42614638
575611.728754337 3189264.33816728
575610.825894415 3189274.31743727
575610.019497925 3189284.29914302
575612.199764593 3189294.35626689
575614.140766277 3189304.40734924
575616.755327358 3189314.47544050
575618.552527076 3189319.13850901
575621.878551158 3189324.60688061
575628.162248551 3189334.67588513
575628.217729738 3189334.76902672
575635.418719721 3189344.95293626
575637.762350507 3189350.59416235
575640.873491159 3189355.09275120
575647.522419377 3189360.17761406
575652.554788934 3189365.38980024
575657.207443596 3189372.73287452
575660.346312788 3189375.58862551
575667.041781573 3189379.37523935
575673.376126510 3189385.91973087
575676.723934510 3189392.04419395
575680.359244947 3189396.09814467
575686.526280383 3189399.95347416
575693.260598684 3189406.42600951
575696.245920828 3189411.13790683
575701.943322200 3189416.64734516
575706.050815019 3189418.94628958
575715.930434190 3189423.79558285
575723.484025899 3189427.19337957
575725.793998076 3189429.28068546
575735.775124065 3189430.11037054
575745.755309984 3189430.97731069
575750.945388100 3189427.88685048
575755.879236329 3189426.15217806
575765.956578764 3189423.17178706
575776.025683486 3189420.51763495
575779.517405427 3189418.60628718
575785.884931838 3189408.76500175
575786.332681882 3189408.44290783
575796.433874881 3189404.51810025
575806.560091648 3189399.60237019
575808.088283081 3189399.32360785
575816.676357286 3189395.08072864
575819.981180111 3189389.62184792
575826.994371634 3189382.56978788
575832.212012345 3189379.92861994
575837.242777695 3189372.81535473
575838.008516413 3189370.07290944
575840.812110902 3189360.14162087
575842.594128381 3189350.18453504
575847.474455532 3189340.30568737
575848.111345114 3189338.50205485
575854.967611222 3189330.49281788
575855.989375110 3189320.51653295
575857.810750377 3189310.56043949
575854.671003314 3189300.47906917
575852.328243476 3189290.41782454
575849.406644524 3189287.20664394
575845.929355550 3189280.25415686
575841.477934729 3189270.13966651
575839.935268430 3189266.18969967
575834.930938952 3189259.97226068
575830.172676589 3189256.70535602
575823.102617400 3189249.67149545
575820.455440295 3189245.42484822
575813.145830725 3189239.41799054
575810.633609741 3189238.28648202
575800.759767900 3189233.20788699
575791.729334709 3189228.87511614
575790.885959615 3189228.12798485
575781.089451899 3189219.98683027
575777.562658171 3189218.51531071
575771.160574863 3189217.08781557
575761.222464867 3189214.55447377
575751.293622469 3189211.65414062
575741.345269581 3189209.52649525
575734.009662553 3189207.41347302
575731.422838196 3189206.37232435] If I have two data sets(each from xy data) and they are intersect at more than two points, How can I find the area between intersection points? If there are more than one area, i.e., Area1, Area2, etc, I would like to find each area separately and assign +ve and -ve sign to the areas? Figure and Example of my data is below (data1 and data2):
data1 = [575721.678739338 3189196.15577354
575711.702452018 3189195.13447944
575701.688569224 3189195.60208872
575691.697320475 3189195.17336187
575681.678990798 3189195.81713592
575676.797287407 3189195.96672958
575671.667154953 3189196.20376653
575661.619557374 3189198.00667871
575651.499830521 3189202.66611234
575645.227659483 3189205.17163764
575641.392720288 3189206.82592006
575637.150456055 3189214.96975033
575633.985427757 3189224.89189997
575630.732860735 3189232.87583130
575629.825200565 3189234.78891918
575626.268606140 3189244.70118035
575625.055756129 3189254.67262378
575624.048800203 3189264.64926620
575626.033070719 3189274.70144150
575628.301047757 3189284.76078116
575629.348139014 3189287.71323321
575630.865563282 3189294.82760927
575632.585061618 3189304.87309963
575633.749353391 3189314.90457031
575634.569486755 3189324.92735054
575636.649511930 3189334.98194565
575638.050011320 3189339.20256643
575640.817786629 3189345.08927361
575647.656595518 3189354.86415159
575647.870775185 3189355.26944727
575654.747228098 3189365.44516408
575657.269399466 3189370.27939153
575662.074406641 3189375.63226375
575667.058357271 3189378.71883487
575674.871973717 3189385.95750447
575676.800091128 3189389.02837035
575684.133094564 3189396.19344337
575686.586685119 3189397.56143505
575696.422894795 3189404.12972127
575700.864844918 3189406.61803541
575706.247405814 3189411.16129194
575715.751567506 3189416.99603830
575716.098781051 3189417.12905527
575726.036514414 3189419.67706070
575736.017098070 3189420.52822388
575745.982395609 3189421.98474492
575756.005774219 3189421.14128728
575766.053610679 3189419.32932771
575769.136073507 3189418.34413225
575776.223506655 3189412.68383576
575779.240944960 3189408.59722472
575786.447078405 3189403.91279079
575796.523744120 3189400.95926314
575799.389111391 3189399.10393297
575805.535189846 3189389.25705318
575806.854089989 3189387.95995545
575816.972618517 3189383.34868686
575819.537289559 3189379.60855471
575822.008081040 3189369.66886365
575827.547621183 3189360.66081291
575828.761131424 3189359.83730830
575836.931299811 3189350.04153712
575837.844535516 3189348.98535223
575840.943246114 3189340.14076154
575843.602853864 3189330.20583632
575846.984577107 3189320.28914546
575848.756275143 3189312.96214604
575850.522840530 3189310.37640707
575854.053180112 3189300.46346810
575854.964811253 3189290.48440209
575851.181415037 3189280.38677937
575849.764141289 3189273.04921042
575849.517599011 3189270.34267971
575843.653125281 3189260.19250792
575840.207154651 3189255.42251920
575835.594666340 3189249.98693602
575830.470162708 3189244.92434067
575823.627599270 3189239.68266813
575820.649830226 3189237.72661781
575810.781232117 3189232.44033033
575805.255617650 3189229.21667049
575800.963379230 3189225.14444292
575791.086532261 3189220.18486820
575787.656625601 3189218.77019437
575781.182921444 3189216.28522513
575771.266091576 3189212.90911181
575761.354718952 3189209.31690449
575758.250526886 3189208.02557942
575751.503530051 3189203.34130216
575741.563262126 3189200.89346790
575731.630100857 3189198.16421964
575727.023285731 3189197.23498323
575721.678739338 3189196.15577354]
data2 = [575731.422838196 3189206.37232435
575724.697961952 3189207.17834314
575721.394010027 3189207.43174664
575711.364654134 3189208.51209622
575701.337970259 3189209.48665581
575691.319597425 3189210.13210704
575681.265867243 3189212.17781946
575671.229649118 3189213.53004162
575661.238791658 3189213.08590592
575651.213949200 3189213.98768238
575647.113409301 3189215.22132567
575640.991573607 3189222.71223818
575639.486204725 3189225.03080093
575630.773146661 3189231.28042522
575626.361206512 3189234.70144909
575620.515832815 3189241.38861678
575619.227201771 3189244.52337575
575615.294804439 3189254.42614638
575611.728754337 3189264.33816728
575610.825894415 3189274.31743727
575610.019497925 3189284.29914302
575612.199764593 3189294.35626689
575614.140766277 3189304.40734924
575616.755327358 3189314.47544050
575618.552527076 3189319.13850901
575621.878551158 3189324.60688061
575628.162248551 3189334.67588513
575628.217729738 3189334.76902672
575635.418719721 3189344.95293626
575637.762350507 3189350.59416235
575640.873491159 3189355.09275120
575647.522419377 3189360.17761406
575652.554788934 3189365.38980024
575657.207443596 3189372.73287452
575660.346312788 3189375.58862551
575667.041781573 3189379.37523935
575673.376126510 3189385.91973087
575676.723934510 3189392.04419395
575680.359244947 3189396.09814467
575686.526280383 3189399.95347416
575693.260598684 3189406.42600951
575696.245920828 3189411.13790683
575701.943322200 3189416.64734516
575706.050815019 3189418.94628958
575715.930434190 3189423.79558285
575723.484025899 3189427.19337957
575725.793998076 3189429.28068546
575735.775124065 3189430.11037054
575745.755309984 3189430.97731069
575750.945388100 3189427.88685048
575755.879236329 3189426.15217806
575765.956578764 3189423.17178706
575776.025683486 3189420.51763495
575779.517405427 3189418.60628718
575785.884931838 3189408.76500175
575786.332681882 3189408.44290783
575796.433874881 3189404.51810025
575806.560091648 3189399.60237019
575808.088283081 3189399.32360785
575816.676357286 3189395.08072864
575819.981180111 3189389.62184792
575826.994371634 3189382.56978788
575832.212012345 3189379.92861994
575837.242777695 3189372.81535473
575838.008516413 3189370.07290944
575840.812110902 3189360.14162087
575842.594128381 3189350.18453504
575847.474455532 3189340.30568737
575848.111345114 3189338.50205485
575854.967611222 3189330.49281788
575855.989375110 3189320.51653295
575857.810750377 3189310.56043949
575854.671003314 3189300.47906917
575852.328243476 3189290.41782454
575849.406644524 3189287.20664394
575845.929355550 3189280.25415686
575841.477934729 3189270.13966651
575839.935268430 3189266.18969967
575834.930938952 3189259.97226068
575830.172676589 3189256.70535602
575823.102617400 3189249.67149545
575820.455440295 3189245.42484822
575813.145830725 3189239.41799054
575810.633609741 3189238.28648202
575800.759767900 3189233.20788699
575791.729334709 3189228.87511614
575790.885959615 3189228.12798485
575781.089451899 3189219.98683027
575777.562658171 3189218.51531071
575771.160574863 3189217.08781557
575761.222464867 3189214.55447377
575751.293622469 3189211.65414062
575741.345269581 3189209.52649525
575734.009662553 3189207.41347302
575731.422838196 3189206.37232435] area, intersection points MATLAB Answers — New Questions
There is some problem with insertshape function in my matlab program
% Define area threshold (e.g., 100 pixels)
areaThreshold = 500; % Set your desired threshold value here
% Read the TIFF image
image = imread(‘quartz1.tif’);
% Convert to grayscale if not already
if size(image, 3) == 3
grayImage = rgb2gray(image);
else
grayImage = image;
end
% Apply Gaussian blur
blurredImage = imgaussfilt(grayImage, 2);
% Enhance contrast
enhancedImage = imadjust(blurredImage);
% Apply sharpening
sharpenedImage = imsharpen(enhancedImage);
% Detect edges
edges = edge(sharpenedImage, ‘Canny’);
% Find contours
contours = bwconncomp(edges);
% Calculate properties for each grain
stats = regionprops(contours, ‘Area’, ‘Perimeter’, ‘MajorAxisLength’, ‘MinorAxisLength’, ‘Orientation’, ‘BoundingBox’, ‘PixelIdxList’, ‘Centroid’);
% Process each grain
for i = 1:length(stats)
if stats(i).Area > areaThreshold
% Get the bounding box for each grain
bb = stats(i).BoundingBox;
grainRegion = imcrop(grayImage, bb);
% Create a new image to draw axes
grainImageWithAxes = cat(3, grainRegion, grainRegion, grainRegion);
% Get the ellipse properties
orientation = stats(i).Orientation;
majorAxisLength = stats(i).MajorAxisLength;
minorAxisLength = stats(i).MinorAxisLength;
perimeter = stats(i).Perimeter; % Perimeter value
centerX = stats(i).Centroid(1) – bb(1);
centerY = stats(i).Centroid(2) – bb(2);
% Compute the endpoints of the major and minor axes
majorAxisEnd1 = [centerX + majorAxisLength / 2 * cosd(orientation), centerY – majorAxisLength / 2 * sind(orientation)];
majorAxisEnd2 = [centerX – majorAxisLength / 2 * cosd(orientation), centerY + majorAxisLength / 2 * sind(orientation)];
minorAxisEnd1 = [centerX + minorAxisLength / 2 * cosd(orientation + 90), centerY – minorAxisLength / 2 * sind(orientation + 90)];
minorAxisEnd2 = [centerX – minorAxisLength / 2 * cosd(orientation + 90), centerY + minorAxisLength / 2 * sind(orientation + 90)];
% Ensure endpoints are within bounds of the image
majorAxisEnd1 = max(min(majorAxisEnd1, size(grainRegion, 2) – 1), 1);
majorAxisEnd2 = max(min(majorAxisEnd2, size(grainRegion, 2) – 1), 1);
minorAxisEnd1 = max(min(minorAxisEnd1, size(grainRegion, 2) – 1), 1);
minorAxisEnd2 = max(min(minorAxisEnd2, size(grainRegion, 2) – 1), 1);
% Draw the axes
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Line’, [majorAxisEnd1, majorAxisEnd2], ‘Color’, ‘red’, ‘LineWidth’, 3);
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Line’, [minorAxisEnd1, minorAxisEnd2], ‘Color’, ‘blue’, ‘LineWidth’, 3);
% Draw contour (perimeter)
contour = bwboundaries(contours.PixelIdxList{i});
contourVertices = contour{1} – [bb(1), bb(2)];
% Convert contourVertices to a cell array with one matrix
contourVerticesCell = {contourVertices};
% Draw the contour
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Polygon’, ‘Vertices’, {contourVertices}, ‘Color’, ‘green’, ‘LineWidth’, 2);
% Add text annotations with larger font size
grainImageWithAxes = insertText(grainImageWithAxes, [10 10], sprintf(‘Major Axis: %.2f’, majorAxisLength), ‘FontSize’, 12, ‘TextColor’, ‘red’, ‘BoxColor’, ‘black’);
grainImageWithAxes = insertText(grainImageWithAxes, [10 30], sprintf(‘Minor Axis: %.2f’, minorAxisLength), ‘FontSize’, 12, ‘TextColor’, ‘blue’, ‘BoxColor’, ‘black’);
grainImageWithAxes = insertText(grainImageWithAxes, [10 50], sprintf(‘Perimeter: %.2f’, perimeter), ‘FontSize’, 12, ‘TextColor’, ‘green’, ‘BoxColor’, ‘black’);
% Save the image with axes using PNG format
filename = sprintf(‘grain_%d_axes.png’, i);
imwrite(grainImageWithAxes, filename, ‘PNG’);
% Display the image with axes
figure;
imshow(grainImageWithAxes);
title(sprintf(‘Sand Grain %d’, i));
end
end
the error i am getting is
Error using insertShape
Expected POSITION to be one of these types:
cell
Error in insertShape>checkPosition (line 332)
validateattributes(position,{‘cell’}, {‘nonempty’, ‘vector’}, …
Error in insertShape>validateAndParseInputs (line 256)
checkPosition(position, shape1);
Error in insertShape (line 129)
validateAndParseInputs(I, shape, position, varargin{:});
Error in untitled8 (line 74)
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Polygon’, ‘Vertices’, {contourVertices}, ‘Color’, ‘green’, ‘LineWidth’, 2);% Define area threshold (e.g., 100 pixels)
areaThreshold = 500; % Set your desired threshold value here
% Read the TIFF image
image = imread(‘quartz1.tif’);
% Convert to grayscale if not already
if size(image, 3) == 3
grayImage = rgb2gray(image);
else
grayImage = image;
end
% Apply Gaussian blur
blurredImage = imgaussfilt(grayImage, 2);
% Enhance contrast
enhancedImage = imadjust(blurredImage);
% Apply sharpening
sharpenedImage = imsharpen(enhancedImage);
% Detect edges
edges = edge(sharpenedImage, ‘Canny’);
% Find contours
contours = bwconncomp(edges);
% Calculate properties for each grain
stats = regionprops(contours, ‘Area’, ‘Perimeter’, ‘MajorAxisLength’, ‘MinorAxisLength’, ‘Orientation’, ‘BoundingBox’, ‘PixelIdxList’, ‘Centroid’);
% Process each grain
for i = 1:length(stats)
if stats(i).Area > areaThreshold
% Get the bounding box for each grain
bb = stats(i).BoundingBox;
grainRegion = imcrop(grayImage, bb);
% Create a new image to draw axes
grainImageWithAxes = cat(3, grainRegion, grainRegion, grainRegion);
% Get the ellipse properties
orientation = stats(i).Orientation;
majorAxisLength = stats(i).MajorAxisLength;
minorAxisLength = stats(i).MinorAxisLength;
perimeter = stats(i).Perimeter; % Perimeter value
centerX = stats(i).Centroid(1) – bb(1);
centerY = stats(i).Centroid(2) – bb(2);
% Compute the endpoints of the major and minor axes
majorAxisEnd1 = [centerX + majorAxisLength / 2 * cosd(orientation), centerY – majorAxisLength / 2 * sind(orientation)];
majorAxisEnd2 = [centerX – majorAxisLength / 2 * cosd(orientation), centerY + majorAxisLength / 2 * sind(orientation)];
minorAxisEnd1 = [centerX + minorAxisLength / 2 * cosd(orientation + 90), centerY – minorAxisLength / 2 * sind(orientation + 90)];
minorAxisEnd2 = [centerX – minorAxisLength / 2 * cosd(orientation + 90), centerY + minorAxisLength / 2 * sind(orientation + 90)];
% Ensure endpoints are within bounds of the image
majorAxisEnd1 = max(min(majorAxisEnd1, size(grainRegion, 2) – 1), 1);
majorAxisEnd2 = max(min(majorAxisEnd2, size(grainRegion, 2) – 1), 1);
minorAxisEnd1 = max(min(minorAxisEnd1, size(grainRegion, 2) – 1), 1);
minorAxisEnd2 = max(min(minorAxisEnd2, size(grainRegion, 2) – 1), 1);
% Draw the axes
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Line’, [majorAxisEnd1, majorAxisEnd2], ‘Color’, ‘red’, ‘LineWidth’, 3);
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Line’, [minorAxisEnd1, minorAxisEnd2], ‘Color’, ‘blue’, ‘LineWidth’, 3);
% Draw contour (perimeter)
contour = bwboundaries(contours.PixelIdxList{i});
contourVertices = contour{1} – [bb(1), bb(2)];
% Convert contourVertices to a cell array with one matrix
contourVerticesCell = {contourVertices};
% Draw the contour
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Polygon’, ‘Vertices’, {contourVertices}, ‘Color’, ‘green’, ‘LineWidth’, 2);
% Add text annotations with larger font size
grainImageWithAxes = insertText(grainImageWithAxes, [10 10], sprintf(‘Major Axis: %.2f’, majorAxisLength), ‘FontSize’, 12, ‘TextColor’, ‘red’, ‘BoxColor’, ‘black’);
grainImageWithAxes = insertText(grainImageWithAxes, [10 30], sprintf(‘Minor Axis: %.2f’, minorAxisLength), ‘FontSize’, 12, ‘TextColor’, ‘blue’, ‘BoxColor’, ‘black’);
grainImageWithAxes = insertText(grainImageWithAxes, [10 50], sprintf(‘Perimeter: %.2f’, perimeter), ‘FontSize’, 12, ‘TextColor’, ‘green’, ‘BoxColor’, ‘black’);
% Save the image with axes using PNG format
filename = sprintf(‘grain_%d_axes.png’, i);
imwrite(grainImageWithAxes, filename, ‘PNG’);
% Display the image with axes
figure;
imshow(grainImageWithAxes);
title(sprintf(‘Sand Grain %d’, i));
end
end
the error i am getting is
Error using insertShape
Expected POSITION to be one of these types:
cell
Error in insertShape>checkPosition (line 332)
validateattributes(position,{‘cell’}, {‘nonempty’, ‘vector’}, …
Error in insertShape>validateAndParseInputs (line 256)
checkPosition(position, shape1);
Error in insertShape (line 129)
validateAndParseInputs(I, shape, position, varargin{:});
Error in untitled8 (line 74)
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Polygon’, ‘Vertices’, {contourVertices}, ‘Color’, ‘green’, ‘LineWidth’, 2); % Define area threshold (e.g., 100 pixels)
areaThreshold = 500; % Set your desired threshold value here
% Read the TIFF image
image = imread(‘quartz1.tif’);
% Convert to grayscale if not already
if size(image, 3) == 3
grayImage = rgb2gray(image);
else
grayImage = image;
end
% Apply Gaussian blur
blurredImage = imgaussfilt(grayImage, 2);
% Enhance contrast
enhancedImage = imadjust(blurredImage);
% Apply sharpening
sharpenedImage = imsharpen(enhancedImage);
% Detect edges
edges = edge(sharpenedImage, ‘Canny’);
% Find contours
contours = bwconncomp(edges);
% Calculate properties for each grain
stats = regionprops(contours, ‘Area’, ‘Perimeter’, ‘MajorAxisLength’, ‘MinorAxisLength’, ‘Orientation’, ‘BoundingBox’, ‘PixelIdxList’, ‘Centroid’);
% Process each grain
for i = 1:length(stats)
if stats(i).Area > areaThreshold
% Get the bounding box for each grain
bb = stats(i).BoundingBox;
grainRegion = imcrop(grayImage, bb);
% Create a new image to draw axes
grainImageWithAxes = cat(3, grainRegion, grainRegion, grainRegion);
% Get the ellipse properties
orientation = stats(i).Orientation;
majorAxisLength = stats(i).MajorAxisLength;
minorAxisLength = stats(i).MinorAxisLength;
perimeter = stats(i).Perimeter; % Perimeter value
centerX = stats(i).Centroid(1) – bb(1);
centerY = stats(i).Centroid(2) – bb(2);
% Compute the endpoints of the major and minor axes
majorAxisEnd1 = [centerX + majorAxisLength / 2 * cosd(orientation), centerY – majorAxisLength / 2 * sind(orientation)];
majorAxisEnd2 = [centerX – majorAxisLength / 2 * cosd(orientation), centerY + majorAxisLength / 2 * sind(orientation)];
minorAxisEnd1 = [centerX + minorAxisLength / 2 * cosd(orientation + 90), centerY – minorAxisLength / 2 * sind(orientation + 90)];
minorAxisEnd2 = [centerX – minorAxisLength / 2 * cosd(orientation + 90), centerY + minorAxisLength / 2 * sind(orientation + 90)];
% Ensure endpoints are within bounds of the image
majorAxisEnd1 = max(min(majorAxisEnd1, size(grainRegion, 2) – 1), 1);
majorAxisEnd2 = max(min(majorAxisEnd2, size(grainRegion, 2) – 1), 1);
minorAxisEnd1 = max(min(minorAxisEnd1, size(grainRegion, 2) – 1), 1);
minorAxisEnd2 = max(min(minorAxisEnd2, size(grainRegion, 2) – 1), 1);
% Draw the axes
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Line’, [majorAxisEnd1, majorAxisEnd2], ‘Color’, ‘red’, ‘LineWidth’, 3);
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Line’, [minorAxisEnd1, minorAxisEnd2], ‘Color’, ‘blue’, ‘LineWidth’, 3);
% Draw contour (perimeter)
contour = bwboundaries(contours.PixelIdxList{i});
contourVertices = contour{1} – [bb(1), bb(2)];
% Convert contourVertices to a cell array with one matrix
contourVerticesCell = {contourVertices};
% Draw the contour
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Polygon’, ‘Vertices’, {contourVertices}, ‘Color’, ‘green’, ‘LineWidth’, 2);
% Add text annotations with larger font size
grainImageWithAxes = insertText(grainImageWithAxes, [10 10], sprintf(‘Major Axis: %.2f’, majorAxisLength), ‘FontSize’, 12, ‘TextColor’, ‘red’, ‘BoxColor’, ‘black’);
grainImageWithAxes = insertText(grainImageWithAxes, [10 30], sprintf(‘Minor Axis: %.2f’, minorAxisLength), ‘FontSize’, 12, ‘TextColor’, ‘blue’, ‘BoxColor’, ‘black’);
grainImageWithAxes = insertText(grainImageWithAxes, [10 50], sprintf(‘Perimeter: %.2f’, perimeter), ‘FontSize’, 12, ‘TextColor’, ‘green’, ‘BoxColor’, ‘black’);
% Save the image with axes using PNG format
filename = sprintf(‘grain_%d_axes.png’, i);
imwrite(grainImageWithAxes, filename, ‘PNG’);
% Display the image with axes
figure;
imshow(grainImageWithAxes);
title(sprintf(‘Sand Grain %d’, i));
end
end
the error i am getting is
Error using insertShape
Expected POSITION to be one of these types:
cell
Error in insertShape>checkPosition (line 332)
validateattributes(position,{‘cell’}, {‘nonempty’, ‘vector’}, …
Error in insertShape>validateAndParseInputs (line 256)
checkPosition(position, shape1);
Error in insertShape (line 129)
validateAndParseInputs(I, shape, position, varargin{:});
Error in untitled8 (line 74)
grainImageWithAxes = insertShape(grainImageWithAxes, ‘Polygon’, ‘Vertices’, {contourVertices}, ‘Color’, ‘green’, ‘LineWidth’, 2); insertshape MATLAB Answers — New Questions