Month: June 2024
OneDrive related license assigned and will it create automatically OneDrive site for user?
Hi All,
As far as I know, there are two options to create OneDrive:
1. User go to portal.office.com/onedrive to set it up
2. Pre-provision OneDrive for users using PowerShell: Request-SPOPersonalSite
But is there another option, if appropriate license assigned to User, then will it create automatically OneDrive site for that user?
Please suggest.
Hi All,As far as I know, there are two options to create OneDrive:1. User go to portal.office.com/onedrive to set it up2. Pre-provision OneDrive for users using PowerShell: Request-SPOPersonalSite But is there another option, if appropriate license assigned to User, then will it create automatically OneDrive site for that user? Please suggest. Read More
SharePoint List date formating help
Hello All,
After failing in my google searches I figured I will ask for help. In the list I have the two collams I want to use to format a thrid. 1. called Current Suspense Date ([$Current_x0020_Suspense_x0020_Dat] in JASON ) which is a date only collum & [$Complete] which is a Yes/No collum.
I need to figure out how to do the folowing in order and stop once an :
If [$Complete] == Yes && [$Current_x0020_Suspense_x0020_Dat] is more than 7 days from today, format green fill.If else [$Current_x0020_Suspense_x0020_Dat] 7 or less days in the future fill yellowIf else [$Current_x0020_Suspense_x0020_Dat] is today or in the past fill Red
Hello All, After failing in my google searches I figured I will ask for help. In the list I have the two collams I want to use to format a thrid. 1. called Current Suspense Date ([$Current_x0020_Suspense_x0020_Dat] in JASON ) which is a date only collum & [$Complete] which is a Yes/No collum. I need to figure out how to do the folowing in order and stop once an :If [$Complete] == Yes && [$Current_x0020_Suspense_x0020_Dat] is more than 7 days from today, format green fill.If else [$Current_x0020_Suspense_x0020_Dat] 7 or less days in the future fill yellowIf else [$Current_x0020_Suspense_x0020_Dat] is today or in the past fill Red Read More
Detect suspicious processes running on hidden desktops
With ransomware campaigns continuing to grow, they remain top of mind for security leaders. Across these sophisticated cyberattacks, the use of remote desktop protocol (RDP) compromise has reached record levels, making it even more critical to provide analysts with full visibility into potentially malicious RDP session use.
That’s why today we are excited to announce a new way to identify potentially compromised devices in your organization via the new ‘DesktopName’ field in Defender for Endpoint, which enables analysts to easily detect, investigate, and hunt for suspicious interactive process executed on so called ‘hidden desktops’.
The importance to RDP
A remote desktop session over RDP (Remote Desktop Protocol) provides users with access to connect remotely to endpoints and is often leveraged as the entry point for attackers to access a target machine. RDP however, introduces some undesirable disadvantages for the attacker.
For example, Windows by default only allows for a single remote RDP session which can cause detectable friction as both the legitimate user and the attacker begin vying for interactivity on the same device. To mitigate this, attackers may opt for other Remote Monitoring and Management (RMM) approaches as described in the examples below.
Approach A: Windows Stations and ‘hidden desktops’
The first approach involves attackers leveraging the creation of additional ‘hidden desktop’ objects to effectively obtain interactive control, separate from the interfaces displayed on—for example the current active desktop that the user is physically working with. With this method, a legitimate user will continue to interact with their machine, unaware of the attacker’s presence in the background.
For this exploit, attackers focus on a Windows user session that can be assigned with multiple Windows Station objects. Amongst the Windows Station objects, only one can be interactive per session and as such, most services that use other Window Stations are not interactive. Each Windows Station object can contain multiple desktop objects, which when contained within the interactive Window Station object, can display a GUI (Graphical User Interface). It is this interactive GUI where the hidden desktop exploit takes place.
There are other tangential advantages for the attacker using this technique, for example, the clipboard in the Window Station context that is shared by all Desktops contained within that Window Station.
Approach B: The hVNC technique
Hidden virtual network computing or hVNC is a variant of standard VNC (virtual network computing) but uses a feature in Windows which allows for multiple interactive desktops to exist simultaneously in a single user session. The hVNC technique enables attackers to remotely control events on the targeted device by opening a hidden instance as a virtual desktop—in parallel to the user’s existing session—before wiping any trace of activity by creating a new Windows desktop in place.
The hVNC technique is commoditized and has been observed in Advanced Persistent Threat campaigns and commodity malware alike—for instance, Cobalt Strike Beacon Object Files leveraging this technique are also readily available.
While there are many legitimate use cases for hidden desktops that can aid productivity, the two use cases above outline how attackers can potentially abuse them as well. That’s why the ability to detect the use of hidden desktops in fully understand a threat campaign can be critical to trace an adversary’s steps and ensure they are fully removed from the system.
Advanced Detection with Defender for Endpoint
Figures 1 and 2 showcase these new detection capabilities in Defender for Endpoint, where an adversary is running an interactive powsershell.exe instance on a hidden desktop.
Defender for Endpoint has detected the anomalous nature of this execution and raised an alert.
The context is also available in Advanced Hunting for custom detection and investigation purposes.
An Advanced Hunting query can be used to display all instances of a specific process that is run on a Desktop that could be irregular. We see in the example below, the discovery of an instance of msedge executing suspiciously:
DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName == “msedge.exe”
| extend DesktopName = tolower(todynamic(AdditionalFields).DesktopName)
| where isnotempty(DesktopName)
| where DesktopName != “winsta0\default” // Ignore instances on primary interactive desktop
and DesktopName !has “sbox” // Filter out sandbox processes
| project Timestamp, FileName, DesktopName, ProcessCommandLine
| order by Timestamp desc
Comprehensive endpoint security
The ability to identify malicious use of hidden desktops in Defender for Endpoint gives admins more granular visibility and control over the detection, investigation, and hunting in unique edge cases, and helps them stay one step ahead of the evolving threat landscape.
For more information:
Learn more about Advanced Hunting in Microsoft Defender XDR: Overview – Advanced hunting | Microsoft Learn
Learn more about Defender for Endpoint: Microsoft Defender for Endpoint | Microsoft Security
Not a Defender for Endpoint customer? Start a free trial today.
Learn more about the hVNC technique:
Anatomy of an hVNC Attack (securityintelligence.com)
Elastic Security Labs discovers the LOBSHOT malware — Elastic Security Labs
Who_Hid_My_Desktop_Or_Safran_Pavel_Asinovsky.pdf (deepsec.net).
Microsoft Tech Community – Latest Blogs –Read More
Easily deploy and manage hundreds of Teams Rooms on Windows with Autopilot and Autologin
Deployment of Teams Rooms on Windows is getting a serious upgrade. As announced at InfoComm this week, Autopilot and Autologin for Teams Rooms on Windows is now generally available. It enables you to deploy at scale and configure Teams Rooms with minimal onsite interaction, which can help save you time and resources.
To enable Windows Autopilot and Autologin for your Teams Rooms, refer to the documentation or watch this video.
Configuration: What to expect
We’re hearing positive feedback from our customers. Here is what a few of them have to say:
“So smooth and it only took 10min. Way better deployment experience.”
“We want to register all our existing devices to redeploy and make them manageable with the help of Intune.”
Configuring requires many steps, but most steps are done only once or very rarely. A simple way to think of the steps are:
Configure prerequisites for Autopilot
Register Autopilot capable MTRs ideally through a partner, or by yourself in Intune
Assign relevant management configurations to the devices
Sync the Autopilot devices to the Teams Rooms Pro Management Portal and assign respective resource accounts to the devices.
Why would I use Autopilot and Autologin?
Whether you’re deploying dozens of new Teams Rooms on Windows or redeploying existing rooms, you can realize the many benefits of Autopilot and Autologin.
Pre-registration
Pre-registration of devices to your tenant enables management of the device before it powers on. Group the device, assign an Autopilot profile, assign device management policies, and associate the device to a resource account for Autologin. Imagine, you could have the devices registered to your tenant and configured in the cloud before they even show up to the site!
Rapid, touchless provisioning during site installation
Once the devices are on-site and ready for installation, the installer can simply unbox the device, plug in power and ethernet, turn it on, and walk away. The device will provision Windows, automatically, EntraID join, enroll in Endpoint management, update Windows and the Teams Rooms application, and finally Autologin to the associated resource account. From power-up to meeting-ready, touchless and in minutes.
Remote redeployment or recovery
By leveraging both the Intune and the Teams Rooms Pro Management portal, admins can redeploy or recover Teams Rooms on Windows with a few clicks (hopefully from a tropical beach)!
Firstly, in the Teams Rooms Pro Management portal, assign credentials to the target Autopilot device. This is also true for recovery of the device, where the intention is to Autologin to the previous account. Once credentials are successfully assigned, head over to Intune to perform a device reset with the “Wipe” action (make sure to use the right one!).
Logistics
A crucial part of what makes Autopilot and Autologin possible is the device registration process. Partners can register devices for customers if they have:
Access to the Devices page for customers in Microsoft Partner Center, and
Established a relationship must with the customer tenant.
If you currently order devices through a partner, ask if they meet those prerequisites.
Go try it!
We are excited to offer this new feature, and hope it saves you time and effort. We appreciate your input, so share your thoughts and questions on this blog post!
Microsoft Tech Community – Latest Blogs –Read More
EVENT RECAP | TechCon365 & PWRCON – Seattle, WA 2024
800 tech enthusiasts descended upon Seattle, WA between June 3-7, 2024, to attend the combined TechCon365 & PWRCON events. We, too, were pleased to join in this community gathering – to participate and gain input from everyone. It was a packed week filled with feedback, stories, and fun. Below is a recap of various aspects of the event – across keynotes, breakout sessions, D&I lunch, AMA/SharePint, and the bustling Expo Hall.
Beyond reading below, review updates and photos from the TechCon365 event team; we sprinkled our own throughout this article.
TechCon365 & PWRCON – Seattle in a nutshell:
800+ attendees
100+ speakers overall – 45 from Microsoft
130 sessions | 25 tutorials (workshops) [review all in our pre-show event guide]
20+ sponsors | One big Expo Hall
Keynotes & general sessions
The event kicked off with a TechCon365 keynote, “Thriving in the Era of AI” with Adam Harmetz (VP), Russell Dicker (CVP), Karuana Gatimu (Principal PM Manager), Melissa Torres (Principal PM Manager), Miceile Barrett (Principal PM), and Michael Holste (Senior PMM). The team brought unique insights about Copilot and AI innovation, advances in employee experiences, content services that help automate the flow of work, and perspectives across roles: Business, IT Pros, and Developers. The keynote packed in product updates and demos across Copilot, Teams, Viva, SharePoint, OneDrive, and more. Our goal was to provide a solid understanding of our strategy and vision, with clarity on where Microsoft is taking content, communication, and collaboration into the future.
On day two, Nirav Shah (CVP) presented the PWRCON keynote: “Empowering transformation: Power Platform and Dataverse in the age of AI.” Nirav showcased powerful business applications across Power Platform that help our customers leap ahead when using AI, taking advantage of Copilot in the various Power Platform apps and services. Our goal is to highlight how you can take existing enterprise data and business processes to unlock the benefits of Microsoft Copilot. The changing AI workspace is real, and it is humbling to hear and showcase how real Power Platform customers use the latest technologies.
General sessions
As the week progressed, each event held high-value general sessions to frame a deeper discussion around the core areas of each product area, Microsoft 365 and Power Platform. With M365 sessions like, “Getting ready for Copilot for Microsoft 365” – with Karuana Gatimu, Ben Summers, and Cynthia Johnson, “SharePoint Premium – Intelligent content for everyone” with Sesha Mani and Wayne Ewington, and “What’s new and next for Microsoft Viva” with Michael Holste and Kristi Kelly. Plus, Power Platform sessions like “Power Automate and automation in the Age of AI: strategy & roadmap” with Ashvini Sharma, “Power Platform Architecture” with Ilya Grebnov, “What’s new in Dataverse & AI Builder: How to easily build generative AI business applications” with Yogi Naik, and “Building the apps of the future today with Power Platform and Copilot” with Leon Welicki.
Breakout sessions & AMA
Breakouts are where learning breaks out. We know it’s crucial to ensure your organization is technically ready for the full potential of Copilot for Microsoft 365. Throughout the 130 sessions, attendees were presented with technical readiness and the latest guidance. All presenter experts shared best practices on how to leverage AI and to maximize the benefits of Copilot within your organization – along with a ton of core learning across all the major Microsoft apps and services. The goal was to discover both ‘how-to’ and increase awareness of the ‘what-if’ – focusing on the impact of cloud adoption and gravitating towards Responsible AI.
The Ask Microsoft Anything (AMA) was a rapid fire of questions from the audience – with our panel of experts taking the hot seat to address questions on improvements to SharePoint Events web part, Copilot & SharePoint Premium licensing, Search + collapsible section headers, adoption guidance/materials, and more. It proved a wonderful balance of time, with answers flowing and feedback taken. Plus, there was much SWAG to be given to each person who asked a question.
Expo Hall + D&I + workshops
The *Expo Hall* was hopping with discussions, interviews, smaller-stage talks, SWAG, prizes, and community. Busy vendor booths meant lots of demos, solutions given, and a better understanding of what customers need above and beyond the core apps and platforms.
Diversity & Inclusion Lunch – Women and Allies – Karuana Gatimu and Heather Cook shared stories and took questions from the crowd. This was an engaging and informal lunchtime gathering where everyone worked together on topics that matter to help shape careers and address common challenges and how to address them and overcome them. It was amazing to have a dedicated, purposeful space for sharing ideas, perspectives, and experiences + lunch.
Workshops
Workshop days were attended by about 1/3 of the attendees across 25 workshops. At TechCon365, attendees chose from a diverse set of topics. These include Copilot and AI, SharePoint from introductory to advanced levels, Power BI for professionals, Power Apps and Power Automate for M365/SharePoint, Microsoft 365 essentials, and more. Each catered to different skill levels, from beginners to intermediate users, to enhance productivity, master digital tools, and develop technical skills.
In the end…
We were so pleased to see this Seattle event sell out! And to see and hear the sold-out crowd mingle and share. We are grateful for this year’s active and engaging #TechCon365 & #PWRCON in Seattle — so much goodness, caring, learning, and having fun! Great questions, stories, and a deeper understanding of your concerns. Thank you. Thank you. Thank you!
We look forward to seeing you at the next TechCon365 in DC and/or Dallas.
Cheers, Mark “in his hometown” Kashman & Heather “up from LA” Cook
And if you made it this far, a last collage from Mark Kashman summarizing his overall experience – to share his excitement for engaging with the best community in tech – meeting new people (and taking selfies), being an “expert” and presenting the Lists breakout session with Miceile Barrett, to moderating the AMA (note the SWAG giveaways in the lower-left), and getting to again work with the great TechCon365 event team:
Microsoft Tech Community – Latest Blogs –Read More
What’s new in Windows Autopatch: June 2024
Get ready for the latest and greatest additions to Windows Autopatch, including the public preview of alerts for policy conflicts! Read on for an inside scoop on how Windows feature update and reliability reports can help you stay on top of update compliance targets for your devices.
Alerts for Windows Autopatch policy conflicts (preview)
The newest enhancement to update reports allows you to see which, if any, devices are flagged with conflicting policies. In this preview, IT admins have on-demand access to:
A detailed view of affected devices
A list view of all Windows Autopatch policies that conflict with other device policies in the tenant
A summary view of conflicting policies, affected devices, and open alerts
Alerts that include details of conflicting policies along with their settings and the Microsoft Entra ID groups to which they are assigned
Policies are continuously monitored by Windows Autopatch. When a policy in your tenant is found to be missing, or a modification to a policy affects services, Windows Autopatch will raise alerts. Detailed recommendations about actions that can be taken to help ensure the healthy operation of the service are provided along with the alerts. Alerts will remain in view until they are (manually) resolved.
If devices are flagged, the issues can be actioned within a new blade titled ‘Policy health,’ which is located within the Windows Autopatch blade of Microsoft Intune. Windows Autopatch uses Microsoft Intune policies to set configurations and deliver services. IT admins must respond to service-generated alerts to ensure Autopatch services can be delivered, and service-managed devices remain eligible for the service.
If you have questions or concerns, or need assistance with your policy conflicts, please file a service request by visiting the Microsoft Intune admin center.
Post-update reliability report (public preview)
Managing Windows updates just got easier with another, recently released Windows Autopatch feature: the reliability report. This report provides details to help you improve the reliability of your devices after each update cycle. By tracking update performance over time, the report helps you easily compare the reliability of your devices with earlier cycles so you can see how well updates are performing on your devices and find any patterns or anomalies.
The report also includes a composite device health score that reflects the overall health and performance of your devices based on factors such as crashes, errors, slowdowns, battery life, disk space, and more. Easily troubleshoot any issues with measures of stop code errors on managed devices for each update cycle and device-specific scores on modules associated with the stop codes.
Device update score: Reflects how well your devices are updating, based on factors including update status, compliance, duration, and failures.
Device reliability score: Reflects how reliable your devices are after each update cycle, based on the number and severity of stop code errors.
Device reliability breakdown: A table shows date, time, module, driver, and more for each stop code error.
You can also compare scores at the service level against other Windows Autopatch customers.
To view the reliability report, go to the Microsoft Intune admin center and navigate to Reports > Windows Autopatch > Windows quality updates. Select the Reports tab, then Reliability report.
To learn more about post-update reliability reporting in Windows Autopatch, see our Reliability report (public preview) documentation.
Conclusion
The ideas behind these new features originated from conversations, input, and requests from you, our customers. We are excited to announce these enhancements and hope the new capabilities in Windows Autopatch will help you keep your devices secure and up to date with less hassle and more control. We understand the challenges you face as an IT professional in a large enterprise, and we’re committed to making your experience a positive one with more efficient solutions for update management.
If you want to find out more about Windows Autopatch, please visit the Windows Autopatch website, read our documentation, or watch our guided demos. If you want to try Windows Autopatch for yourself, you can sign up for a free trial or contact us for a demo.
We welcome your feedback and suggestions on how we can continue to make Windows Autopatch even better for you. Please share your thoughts and ideas below or via the Windows Autopatch community. Thank you for choosing Windows Autopatch. Stay tuned for more updates and announcements!
Continue the conversation. Find best practices. Bookmark the Windows Tech Community, then follow us @MSWindowsITPro on X/Twitter. Looking for support? Visit Windows on Microsoft Q&A.
Microsoft Tech Community – Latest Blogs –Read More
Solving all math and teaching it as you go
Hello MATLAB community,
I have another mission for my project and I am trying to get it started.
So the objective is to make a code that can solve math problems but also show you how to solve the input math problem. I know there is certain ways to solve some math problem (adding, subtracting ,etc) however when it get to the gritty of things I would like to make it so go step by step solving problems. Like derivative or finding varibles etc.
I was hopping to have a options on how to input the problem in the code and code solves it but shows how to solve it.
DOes anyone have any idea or suggest or example to get me started and moving?
Thank youHello MATLAB community,
I have another mission for my project and I am trying to get it started.
So the objective is to make a code that can solve math problems but also show you how to solve the input math problem. I know there is certain ways to solve some math problem (adding, subtracting ,etc) however when it get to the gritty of things I would like to make it so go step by step solving problems. Like derivative or finding varibles etc.
I was hopping to have a options on how to input the problem in the code and code solves it but shows how to solve it.
DOes anyone have any idea or suggest or example to get me started and moving?
Thank you Hello MATLAB community,
I have another mission for my project and I am trying to get it started.
So the objective is to make a code that can solve math problems but also show you how to solve the input math problem. I know there is certain ways to solve some math problem (adding, subtracting ,etc) however when it get to the gritty of things I would like to make it so go step by step solving problems. Like derivative or finding varibles etc.
I was hopping to have a options on how to input the problem in the code and code solves it but shows how to solve it.
DOes anyone have any idea or suggest or example to get me started and moving?
Thank you solve, mathematics, numerical integration, calculus MATLAB Answers — New Questions
StartPoint on Curve Fitting Toolbox
I am trying to fit a linear resonance curve of a 2nd order mechanical system to get the Q-factor.
The instrument that I am using to obtain the frequency response function has an in-built curve fitting software that uses the following equation to fit the curve.
denominator = sqrt(f^2 + (Q / f0)^2 * (f^2 – f0^2)^2);
X=A * f / denominator;
(C=0) *image q2.png
A is the amplitude, 𝑄 is the quality factor and 𝑓0 is the center frequency.
My goal is to use MATLAB’s Curve Fitting tool to obtain the Q-factor value; first I want to match the Q-factor value obtained from the instrument (as a validation step, so I can fit more data without requiring the instrument’s curve fitting tool).
Below is the FRF obtained from the instrument–the Q factor value I obtain is 8705.9559
*image q1.png
Center Frequency (f0) = 1496.26
A = 2.4216e-3 (amplitude)
I saved this sweep and plotted and tried to recreate the this fit using the CurveFitting tool box–using the same cut-off range as above (1453 kHz to 1548 kHz)
However, I am having an issue with converging to the value for the Q-factor from the instrument–it varies as I change my StartPoint and Lower and Upper values. I understand this is the case, sensitive to inital conditions–however, I was under the assumption that it may converge to the value as I refine my StartPoint and Lower and Upper bounds—this is not the case.
For example:
With StartPoint= 0; Lower= 10; Upper= 10e3 Q=8052 (7994, 8110) with R-square of 0.9961
moving the StartPoint closer to 8000 (which is around the actual value), it drops
With StartPoint = 7000; Lower=10; Upper= 10e3 Q=8278 (8228, 8329) with R-square of 0.9973
With StartPoint= 8000; Lower= 10; Upper= 10e3 Q=8000 (7940, 8060) with R-square of 0.9961
(varying the Upper and Lower bounds also causes the Q factor value to change–and not converge–to different values that is around value obtained from the instrument)
–I was hoping to get closer and improve the goodness of fit, but the fit is very sensitive to the StartPoint—any pointers on how to get an accurate value?
Is this method, fitting this curve using the CurveFitting Toolbox the best method to get the value for Q?
I have shared my data, code and image snippets. Any pointers appreciated.
clc;clear;close all
data = load(‘data.mat’);
f=data.d(:,1);
A=data.d(:,2);
[fitresult, gof] = createFit(f, A)
function [fitresult, gof] = createFit(f, A)
%CREATEFIT(F,A)
% Create a fit.
%
% Data for ‘untitled fit 1’ fit:
% X Input: f
% Y Output: A
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 12-Jun-2024 17:27:38
%% Fit: ‘untitled fit 1’.
[xData, yData] = prepareCurveData( f, A );
% Set up fittype and options.
ft = fittype( ‘2.4216e-3*f./(sqrt(f^2+(Q/1496.26)^2*(f^2-1496.26^2)^2))’, ‘independent’, ‘f’, ‘dependent’, ‘A’ );
excludedPoints = (xData < 1426.9) | (xData > 1570.4);
opts = fitoptions( ‘Method’, ‘NonlinearLeastSquares’ );
opts.Display = ‘Off’;
opts.Lower = 10;
opts.MaxFunEvals = 1000;
opts.MaxIter = 1000;
opts.StartPoint = 7000;
opts.TolFun = 1e-07;
opts.Upper = 10000;
opts.Exclude = excludedPoints;
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( ‘Name’, ‘untitled fit 1’ );
h = plot( fitresult, xData, yData, excludedPoints );
legend( h, ‘A vs. f’, ‘Excluded A vs. f’, ‘untitled fit 1’, ‘Location’, ‘NorthEast’, ‘Interpreter’, ‘none’ );
% Label axes
xlabel( ‘f’, ‘Interpreter’, ‘none’ );
ylabel( ‘A’, ‘Interpreter’, ‘none’ );
grid on
end
TL;DR–I am trying to understand why the value of Q, obtained from my fit, does not converge to a value (and improve the fit) as I use a guess that is around the accurate value, and reduce the size of the bounds (Lower and Upper)I am trying to fit a linear resonance curve of a 2nd order mechanical system to get the Q-factor.
The instrument that I am using to obtain the frequency response function has an in-built curve fitting software that uses the following equation to fit the curve.
denominator = sqrt(f^2 + (Q / f0)^2 * (f^2 – f0^2)^2);
X=A * f / denominator;
(C=0) *image q2.png
A is the amplitude, 𝑄 is the quality factor and 𝑓0 is the center frequency.
My goal is to use MATLAB’s Curve Fitting tool to obtain the Q-factor value; first I want to match the Q-factor value obtained from the instrument (as a validation step, so I can fit more data without requiring the instrument’s curve fitting tool).
Below is the FRF obtained from the instrument–the Q factor value I obtain is 8705.9559
*image q1.png
Center Frequency (f0) = 1496.26
A = 2.4216e-3 (amplitude)
I saved this sweep and plotted and tried to recreate the this fit using the CurveFitting tool box–using the same cut-off range as above (1453 kHz to 1548 kHz)
However, I am having an issue with converging to the value for the Q-factor from the instrument–it varies as I change my StartPoint and Lower and Upper values. I understand this is the case, sensitive to inital conditions–however, I was under the assumption that it may converge to the value as I refine my StartPoint and Lower and Upper bounds—this is not the case.
For example:
With StartPoint= 0; Lower= 10; Upper= 10e3 Q=8052 (7994, 8110) with R-square of 0.9961
moving the StartPoint closer to 8000 (which is around the actual value), it drops
With StartPoint = 7000; Lower=10; Upper= 10e3 Q=8278 (8228, 8329) with R-square of 0.9973
With StartPoint= 8000; Lower= 10; Upper= 10e3 Q=8000 (7940, 8060) with R-square of 0.9961
(varying the Upper and Lower bounds also causes the Q factor value to change–and not converge–to different values that is around value obtained from the instrument)
–I was hoping to get closer and improve the goodness of fit, but the fit is very sensitive to the StartPoint—any pointers on how to get an accurate value?
Is this method, fitting this curve using the CurveFitting Toolbox the best method to get the value for Q?
I have shared my data, code and image snippets. Any pointers appreciated.
clc;clear;close all
data = load(‘data.mat’);
f=data.d(:,1);
A=data.d(:,2);
[fitresult, gof] = createFit(f, A)
function [fitresult, gof] = createFit(f, A)
%CREATEFIT(F,A)
% Create a fit.
%
% Data for ‘untitled fit 1’ fit:
% X Input: f
% Y Output: A
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 12-Jun-2024 17:27:38
%% Fit: ‘untitled fit 1’.
[xData, yData] = prepareCurveData( f, A );
% Set up fittype and options.
ft = fittype( ‘2.4216e-3*f./(sqrt(f^2+(Q/1496.26)^2*(f^2-1496.26^2)^2))’, ‘independent’, ‘f’, ‘dependent’, ‘A’ );
excludedPoints = (xData < 1426.9) | (xData > 1570.4);
opts = fitoptions( ‘Method’, ‘NonlinearLeastSquares’ );
opts.Display = ‘Off’;
opts.Lower = 10;
opts.MaxFunEvals = 1000;
opts.MaxIter = 1000;
opts.StartPoint = 7000;
opts.TolFun = 1e-07;
opts.Upper = 10000;
opts.Exclude = excludedPoints;
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( ‘Name’, ‘untitled fit 1’ );
h = plot( fitresult, xData, yData, excludedPoints );
legend( h, ‘A vs. f’, ‘Excluded A vs. f’, ‘untitled fit 1’, ‘Location’, ‘NorthEast’, ‘Interpreter’, ‘none’ );
% Label axes
xlabel( ‘f’, ‘Interpreter’, ‘none’ );
ylabel( ‘A’, ‘Interpreter’, ‘none’ );
grid on
end
TL;DR–I am trying to understand why the value of Q, obtained from my fit, does not converge to a value (and improve the fit) as I use a guess that is around the accurate value, and reduce the size of the bounds (Lower and Upper) I am trying to fit a linear resonance curve of a 2nd order mechanical system to get the Q-factor.
The instrument that I am using to obtain the frequency response function has an in-built curve fitting software that uses the following equation to fit the curve.
denominator = sqrt(f^2 + (Q / f0)^2 * (f^2 – f0^2)^2);
X=A * f / denominator;
(C=0) *image q2.png
A is the amplitude, 𝑄 is the quality factor and 𝑓0 is the center frequency.
My goal is to use MATLAB’s Curve Fitting tool to obtain the Q-factor value; first I want to match the Q-factor value obtained from the instrument (as a validation step, so I can fit more data without requiring the instrument’s curve fitting tool).
Below is the FRF obtained from the instrument–the Q factor value I obtain is 8705.9559
*image q1.png
Center Frequency (f0) = 1496.26
A = 2.4216e-3 (amplitude)
I saved this sweep and plotted and tried to recreate the this fit using the CurveFitting tool box–using the same cut-off range as above (1453 kHz to 1548 kHz)
However, I am having an issue with converging to the value for the Q-factor from the instrument–it varies as I change my StartPoint and Lower and Upper values. I understand this is the case, sensitive to inital conditions–however, I was under the assumption that it may converge to the value as I refine my StartPoint and Lower and Upper bounds—this is not the case.
For example:
With StartPoint= 0; Lower= 10; Upper= 10e3 Q=8052 (7994, 8110) with R-square of 0.9961
moving the StartPoint closer to 8000 (which is around the actual value), it drops
With StartPoint = 7000; Lower=10; Upper= 10e3 Q=8278 (8228, 8329) with R-square of 0.9973
With StartPoint= 8000; Lower= 10; Upper= 10e3 Q=8000 (7940, 8060) with R-square of 0.9961
(varying the Upper and Lower bounds also causes the Q factor value to change–and not converge–to different values that is around value obtained from the instrument)
–I was hoping to get closer and improve the goodness of fit, but the fit is very sensitive to the StartPoint—any pointers on how to get an accurate value?
Is this method, fitting this curve using the CurveFitting Toolbox the best method to get the value for Q?
I have shared my data, code and image snippets. Any pointers appreciated.
clc;clear;close all
data = load(‘data.mat’);
f=data.d(:,1);
A=data.d(:,2);
[fitresult, gof] = createFit(f, A)
function [fitresult, gof] = createFit(f, A)
%CREATEFIT(F,A)
% Create a fit.
%
% Data for ‘untitled fit 1’ fit:
% X Input: f
% Y Output: A
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 12-Jun-2024 17:27:38
%% Fit: ‘untitled fit 1’.
[xData, yData] = prepareCurveData( f, A );
% Set up fittype and options.
ft = fittype( ‘2.4216e-3*f./(sqrt(f^2+(Q/1496.26)^2*(f^2-1496.26^2)^2))’, ‘independent’, ‘f’, ‘dependent’, ‘A’ );
excludedPoints = (xData < 1426.9) | (xData > 1570.4);
opts = fitoptions( ‘Method’, ‘NonlinearLeastSquares’ );
opts.Display = ‘Off’;
opts.Lower = 10;
opts.MaxFunEvals = 1000;
opts.MaxIter = 1000;
opts.StartPoint = 7000;
opts.TolFun = 1e-07;
opts.Upper = 10000;
opts.Exclude = excludedPoints;
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( ‘Name’, ‘untitled fit 1’ );
h = plot( fitresult, xData, yData, excludedPoints );
legend( h, ‘A vs. f’, ‘Excluded A vs. f’, ‘untitled fit 1’, ‘Location’, ‘NorthEast’, ‘Interpreter’, ‘none’ );
% Label axes
xlabel( ‘f’, ‘Interpreter’, ‘none’ );
ylabel( ‘A’, ‘Interpreter’, ‘none’ );
grid on
end
TL;DR–I am trying to understand why the value of Q, obtained from my fit, does not converge to a value (and improve the fit) as I use a guess that is around the accurate value, and reduce the size of the bounds (Lower and Upper) curve fitting MATLAB Answers — New Questions
Inserting Rows Outside of Sum Range Changes the Rows Summed
Hi All,
I am having an issue where I need to add rows to an existing sheet above a few rows with sum calculations. The added rows are not within the sum range. When I do this, some of the sum formulas don’t adjust the sum range for the added rows. The error only presents itself in some of the columns (i.e. the sum formula in column C updates but the sum formula in columns D through R with the exact same row range and sum function as column C don’t update). I rebuilt the entire file trying to get rid of this issue, but it has persisted in the new XLS. What am I doing wrong? Is this a settings thing? Please help!!
Hi All, I am having an issue where I need to add rows to an existing sheet above a few rows with sum calculations. The added rows are not within the sum range. When I do this, some of the sum formulas don’t adjust the sum range for the added rows. The error only presents itself in some of the columns (i.e. the sum formula in column C updates but the sum formula in columns D through R with the exact same row range and sum function as column C don’t update). I rebuilt the entire file trying to get rid of this issue, but it has persisted in the new XLS. What am I doing wrong? Is this a settings thing? Please help!! Read More
I need help with a Powershell Script I need to delete any Registry keys, values or Dwords
We updated our print server. I need to remove any Values, Friendly names, or DWORDs that reference the old print server. The old printers were pushed out via GPO by username, and we have computers with up to 50 copies of the same printer, I already tried editing the deployment scripts that did not remove them. I found a few scripts, but none of them seem to remove all of the entries
Here is one of the scrips I am trying to edit
$PrinterReg = Get-ChildItem -Path Registry::HKLMSYSTEMCurrentControlSetEnumSWDPRINTENUM*
$PrinterName = “\Starbase16*”
Foreach ($DeletePrinter in $PrinterReg){
$FriendlyName = $DeletePrinter.GetValue(“Friendlyname”)
if($FriendlyName -eq $PrinterName){
Remove-Item -path $DeletePrinter.PSPath -Recurse
Write-Host “Removing $friendlyname from $($DeletePrinter.PSPath)”
}}
Here are all the Keys that contain Starbase16
ComputerHKEY_CURRENT_USERPrintersConvertUserDevModesCount
ComputerHKEY_CURRENT_USERPrintersSettings
ComputerHKEY_CURRENT_USERSoftwareMicrosoftTerminal Server ClientServersStarbase16
ComputerHKEY_CURRENT_USERSoftwareXeroxPrinterDriverV5.0“Starbase16`2E-Main-Mailroom
ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintPrinterMigrationExCSR|Starbase16
ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintPrintersStarbase16
ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintProvidersClient Side Rendering Print ProviderS-1-5-21-117609710-602162358-725345543-28548PrintersConnections
ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintProvidersClient Side Rendering Print ProviderServersStarbase16MonitorsClient Side Port
ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintProvidersClient Side Rendering Print ProviderServersStarbase16Printers
We updated our print server. I need to remove any Values, Friendly names, or DWORDs that reference the old print server. The old printers were pushed out via GPO by username, and we have computers with up to 50 copies of the same printer, I already tried editing the deployment scripts that did not remove them. I found a few scripts, but none of them seem to remove all of the entriesHere is one of the scrips I am trying to edit$PrinterReg = Get-ChildItem -Path Registry::HKLMSYSTEMCurrentControlSetEnumSWDPRINTENUM*$PrinterName = “\Starbase16*”Foreach ($DeletePrinter in $PrinterReg){$FriendlyName = $DeletePrinter.GetValue(“Friendlyname”)if($FriendlyName -eq $PrinterName){Remove-Item -path $DeletePrinter.PSPath -RecurseWrite-Host “Removing $friendlyname from $($DeletePrinter.PSPath)”}}Here are all the Keys that contain Starbase16 ComputerHKEY_CURRENT_USERPrintersConvertUserDevModesCountComputerHKEY_CURRENT_USERPrintersSettingsComputerHKEY_CURRENT_USERSoftwareMicrosoftTerminal Server ClientServersStarbase16ComputerHKEY_CURRENT_USERSoftwareXeroxPrinterDriverV5.0“Starbase16`2E-Main-MailroomComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintPrinterMigrationExCSR|Starbase16ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintPrintersStarbase16ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintProvidersClient Side Rendering Print ProviderS-1-5-21-117609710-602162358-725345543-28548PrintersConnectionsComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintProvidersClient Side Rendering Print ProviderServersStarbase16MonitorsClient Side PortComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPrintProvidersClient Side Rendering Print ProviderServersStarbase16Printers Read More
“False positive” attachment indication (paper clip icon) but no attachment present
For some users at my company, they are on a new version of Outlook which shows (in the email list panel) a paper-clip icon in the attachment column, for messages with no attachment. This seems to happen mostly with messages that are replies or forwards, where there may have been an attachment at some time in the past but there is no attachment present in the message chain as it stands in this message. This makes it virtually impossible to find the original message that in fact did contain the attachment. Or at least I don’t know the methodology to find it.
There should be no attachment indication if there is no attachment! And it should be easier to find the original message that indeed has the attachment (this is particularly true with conversation-mode type of messages.)
If there is a workaround for the time being, I really would like to know it. I have also submitted feedback to Microsoft to address this in Outlook. Let me know if you have seen this too, or if you know a way to handle it. Thanks.
For some users at my company, they are on a new version of Outlook which shows (in the email list panel) a paper-clip icon in the attachment column, for messages with no attachment. This seems to happen mostly with messages that are replies or forwards, where there may have been an attachment at some time in the past but there is no attachment present in the message chain as it stands in this message. This makes it virtually impossible to find the original message that in fact did contain the attachment. Or at least I don’t know the methodology to find it. There should be no attachment indication if there is no attachment! And it should be easier to find the original message that indeed has the attachment (this is particularly true with conversation-mode type of messages.)If there is a workaround for the time being, I really would like to know it. I have also submitted feedback to Microsoft to address this in Outlook. Let me know if you have seen this too, or if you know a way to handle it. Thanks. Read More
AI and Creativity, something to smooch about
My wife has a plant app. The app identifies plants perfectly.
We discovered that this app can do much more, e.g. recognize birds.
My wife points her phone at me.
I: “But I’m not a bird!” 🥹
My wife: “Let’s find out!”
Result: I’m a saw-whet owl. Another name is “zaaguil”. Scientific name is “Aegolius acadicus”.
Somehow reassuring. Copilot does not recognize a bird in the photo.
My wife has a plant app. The app identifies plants perfectly. We discovered that this app can do much more, e.g. recognize birds. My wife points her phone at me. I: “But I’m not a bird!” 🥹 My wife: “Let’s find out!” Result: I’m a saw-whet owl. Another name is “zaaguil”. Scientific name is “Aegolius acadicus”. Somehow reassuring. Copilot does not recognize a bird in the photo. Read More
Blank Role Based Access Control Persona Table – Defender for Endpoint
The table within the section for Role-Based Access Control is blank and does not contain any information. Defender Endpoint – Prepare-deployment.
The table within the section for Role-Based Access Control is blank and does not contain any information. Defender Endpoint – Prepare-deployment. Read More
Returning a cell’s value based on the location of another cell.
I want to search an entire worksheet for a value and once that value is identified, I want to pull the cell’s value that exists five cells below it. vlook, xlook, and hlookups don’t work because the data isn’t organized into a table. Getting confused by the LOOKUP, MATCH formulas.
I want to search an entire worksheet for a value and once that value is identified, I want to pull the cell’s value that exists five cells below it. vlook, xlook, and hlookups don’t work because the data isn’t organized into a table. Getting confused by the LOOKUP, MATCH formulas. Read More
Unable to edit a Booking in Outlook Calendar
I’m enjoying using the Booking program – however once my staff has scheduled a Team meeting using Booking, I cannot change the duration or time of the meeting. When I go to either open the event to edit, or move it in the calendar, the pop-out to edit the event appears, but is a blank white square. I have to close the pop-out from the start menu, and get a prompt ” Do you want to discard changes to this event” – screenshots are below.
Does anyone have a workaround?
I’m enjoying using the Booking program – however once my staff has scheduled a Team meeting using Booking, I cannot change the duration or time of the meeting. When I go to either open the event to edit, or move it in the calendar, the pop-out to edit the event appears, but is a blank white square. I have to close the pop-out from the start menu, and get a prompt ” Do you want to discard changes to this event” – screenshots are below. Does anyone have a workaround? Read More
The maximum value is not changing even after adding 1
I have an image with values ranging from [0,255]
It’s data is attached below as data.mat below.
I read it and added 1 to its data.
The minimum value of data is changed to 1, but the maximum value of data is still 255.
I don’t understand why.I have an image with values ranging from [0,255]
It’s data is attached below as data.mat below.
I read it and added 1 to its data.
The minimum value of data is changed to 1, but the maximum value of data is still 255.
I don’t understand why. I have an image with values ranging from [0,255]
It’s data is attached below as data.mat below.
I read it and added 1 to its data.
The minimum value of data is changed to 1, but the maximum value of data is still 255.
I don’t understand why. add, max, min, value MATLAB Answers — New Questions
Uistack with GraphPlot (it looks like not working)
I have a GraphPlot array. Some of the GraphPlots have a name. Other GraphPlots, instead, do not have a name. I am trying to reorder the visual stacking of those GraphPlots by using their names, i.e. all the GraphPlots that have a name need to go to the top.
However, If I use
uistack(h(idx),’top’)
nothing changes.
How can I reorder that GraphPlot array, in such a way that GraphPlots without a name go to the bottom of the visual stacking and GraphPlots with a name go to the top?
I reproduced something similar to my case, with 5 Graphplots:
c = {‘b’,’k’,’m’,’y’,’r’};
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
name = {‘apple’,”,”,’banana’,’peach’};
% generate 5 arrays of t = randi([2 8],5,14);
t = [
3 3 4 5 4 6 8 6 2 5 2 8 3 2
6 3 5 5 6 4 5 3 3 2 6 7 6 5
5 7 6 2 2 7 7 8 2 5 5 8 5 8
7 8 6 7 4 4 3 5 6 4 2 8 3 2
7 8 4 8 8 5 6 8 6 5 6 7 4 2];
hold on
for i = 1 : size(t,1)
h(i) = plot(graph(s,t(i,:)),’LineWidth’,3,’EdgeColor’,c{i},’NodeColor’,c{i},’DisplayName’,name{i});
h(i).EdgeAlpha=1;
end
names_plots = {h.DisplayName};
idx = find(~cellfun(@isempty,names_plots));
uistack(h(idx),’top’)
legend(h)I have a GraphPlot array. Some of the GraphPlots have a name. Other GraphPlots, instead, do not have a name. I am trying to reorder the visual stacking of those GraphPlots by using their names, i.e. all the GraphPlots that have a name need to go to the top.
However, If I use
uistack(h(idx),’top’)
nothing changes.
How can I reorder that GraphPlot array, in such a way that GraphPlots without a name go to the bottom of the visual stacking and GraphPlots with a name go to the top?
I reproduced something similar to my case, with 5 Graphplots:
c = {‘b’,’k’,’m’,’y’,’r’};
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
name = {‘apple’,”,”,’banana’,’peach’};
% generate 5 arrays of t = randi([2 8],5,14);
t = [
3 3 4 5 4 6 8 6 2 5 2 8 3 2
6 3 5 5 6 4 5 3 3 2 6 7 6 5
5 7 6 2 2 7 7 8 2 5 5 8 5 8
7 8 6 7 4 4 3 5 6 4 2 8 3 2
7 8 4 8 8 5 6 8 6 5 6 7 4 2];
hold on
for i = 1 : size(t,1)
h(i) = plot(graph(s,t(i,:)),’LineWidth’,3,’EdgeColor’,c{i},’NodeColor’,c{i},’DisplayName’,name{i});
h(i).EdgeAlpha=1;
end
names_plots = {h.DisplayName};
idx = find(~cellfun(@isempty,names_plots));
uistack(h(idx),’top’)
legend(h) I have a GraphPlot array. Some of the GraphPlots have a name. Other GraphPlots, instead, do not have a name. I am trying to reorder the visual stacking of those GraphPlots by using their names, i.e. all the GraphPlots that have a name need to go to the top.
However, If I use
uistack(h(idx),’top’)
nothing changes.
How can I reorder that GraphPlot array, in such a way that GraphPlots without a name go to the bottom of the visual stacking and GraphPlots with a name go to the top?
I reproduced something similar to my case, with 5 Graphplots:
c = {‘b’,’k’,’m’,’y’,’r’};
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
name = {‘apple’,”,”,’banana’,’peach’};
% generate 5 arrays of t = randi([2 8],5,14);
t = [
3 3 4 5 4 6 8 6 2 5 2 8 3 2
6 3 5 5 6 4 5 3 3 2 6 7 6 5
5 7 6 2 2 7 7 8 2 5 5 8 5 8
7 8 6 7 4 4 3 5 6 4 2 8 3 2
7 8 4 8 8 5 6 8 6 5 6 7 4 2];
hold on
for i = 1 : size(t,1)
h(i) = plot(graph(s,t(i,:)),’LineWidth’,3,’EdgeColor’,c{i},’NodeColor’,c{i},’DisplayName’,name{i});
h(i).EdgeAlpha=1;
end
names_plots = {h.DisplayName};
idx = find(~cellfun(@isempty,names_plots));
uistack(h(idx),’top’)
legend(h) uistack, reorder, graphplots, visual stacking, stacking, order, plots MATLAB Answers — New Questions
Apply 2-D logical mask to obtain masked third dimension values in 3-D array
This is difficult to describe in words so I have given an example below. I have a 3-D array. Some of the values are NaNs (although this is not directly relevant to my question). I want to apply a 2-D mask to the first two dimensions and arrange all the third dimensions behind the mask as sequential rows in a 2-D array. I’m looking for a way to do this without ‘for’ loops.
Here’s the example:
% Set up the example 3-D array and mask
BW = logical([0,0,1; 0,1,1; 1,1,0; 1,0,0]); %create a mask
A = 9*ones(4,3,3); % create a 3 dimensional array
A(:,:,2) = 8*ones(4,3); % Make the second ‘slice’ 8s
A(:,:,3) = 7*ones(4,3); % Make the third ‘slice’ 8s
A(1,3,1) = NaN; % add a NaN
A(3,2,3) = NaN; % add another NaN
A(4,1,2) = NaN % add another NaN
% Apply the mask and organise the masked third dimension values into a 2-D array
my2Darray = zeros(1,size(A,3));
for row=1:(size(A,1))
for col=1:(size(A,2))
if (BW(row,col))
mySpectrum = squeeze (A(row, col,:))’;
my2Darray = cat (1, my2Darray, mySpectrum);
end
end
end
my2Darray(1,:) = [] % Get rid of the first row of zeros
The outcome is correct. The total number of rows in my2Darray should be equal to sum(sum(BW)).
But is there an elegant way to reshape this that doesn’t require the ‘for’ loops, please?This is difficult to describe in words so I have given an example below. I have a 3-D array. Some of the values are NaNs (although this is not directly relevant to my question). I want to apply a 2-D mask to the first two dimensions and arrange all the third dimensions behind the mask as sequential rows in a 2-D array. I’m looking for a way to do this without ‘for’ loops.
Here’s the example:
% Set up the example 3-D array and mask
BW = logical([0,0,1; 0,1,1; 1,1,0; 1,0,0]); %create a mask
A = 9*ones(4,3,3); % create a 3 dimensional array
A(:,:,2) = 8*ones(4,3); % Make the second ‘slice’ 8s
A(:,:,3) = 7*ones(4,3); % Make the third ‘slice’ 8s
A(1,3,1) = NaN; % add a NaN
A(3,2,3) = NaN; % add another NaN
A(4,1,2) = NaN % add another NaN
% Apply the mask and organise the masked third dimension values into a 2-D array
my2Darray = zeros(1,size(A,3));
for row=1:(size(A,1))
for col=1:(size(A,2))
if (BW(row,col))
mySpectrum = squeeze (A(row, col,:))’;
my2Darray = cat (1, my2Darray, mySpectrum);
end
end
end
my2Darray(1,:) = [] % Get rid of the first row of zeros
The outcome is correct. The total number of rows in my2Darray should be equal to sum(sum(BW)).
But is there an elegant way to reshape this that doesn’t require the ‘for’ loops, please? This is difficult to describe in words so I have given an example below. I have a 3-D array. Some of the values are NaNs (although this is not directly relevant to my question). I want to apply a 2-D mask to the first two dimensions and arrange all the third dimensions behind the mask as sequential rows in a 2-D array. I’m looking for a way to do this without ‘for’ loops.
Here’s the example:
% Set up the example 3-D array and mask
BW = logical([0,0,1; 0,1,1; 1,1,0; 1,0,0]); %create a mask
A = 9*ones(4,3,3); % create a 3 dimensional array
A(:,:,2) = 8*ones(4,3); % Make the second ‘slice’ 8s
A(:,:,3) = 7*ones(4,3); % Make the third ‘slice’ 8s
A(1,3,1) = NaN; % add a NaN
A(3,2,3) = NaN; % add another NaN
A(4,1,2) = NaN % add another NaN
% Apply the mask and organise the masked third dimension values into a 2-D array
my2Darray = zeros(1,size(A,3));
for row=1:(size(A,1))
for col=1:(size(A,2))
if (BW(row,col))
mySpectrum = squeeze (A(row, col,:))’;
my2Darray = cat (1, my2Darray, mySpectrum);
end
end
end
my2Darray(1,:) = [] % Get rid of the first row of zeros
The outcome is correct. The total number of rows in my2Darray should be equal to sum(sum(BW)).
But is there an elegant way to reshape this that doesn’t require the ‘for’ loops, please? mask, array, reshape MATLAB Answers — New Questions
Problem with converting a value into double
I read 2 matrix from txt files, for example, two 2×3 matrix A=[740 850 550 ; 830 820 200 ] B=[742 851 552 ; 835 818 220 ]
and want to calculate A-B, but in the 2×3 ans, all nubmers are zeros ans= [0 0 0; 0 0 0]
I tried to convert them to double using double(A), double(B), but it doesn’t work
Also I tried several things
A+1 gives me 0.001*(A+1), also, say [0.0741 0.0851 0.0551; 0.0831 0.0821 0.0201]
A+0.1 gives me 0.001*(A), also, say [0.0740 0.0850 0.0550; 0.0830 0.0820 0.0200]
even after A=double(A), then do A+1, it gives me the same values as listed in 1
Can anyone help me to solve this?I read 2 matrix from txt files, for example, two 2×3 matrix A=[740 850 550 ; 830 820 200 ] B=[742 851 552 ; 835 818 220 ]
and want to calculate A-B, but in the 2×3 ans, all nubmers are zeros ans= [0 0 0; 0 0 0]
I tried to convert them to double using double(A), double(B), but it doesn’t work
Also I tried several things
A+1 gives me 0.001*(A+1), also, say [0.0741 0.0851 0.0551; 0.0831 0.0821 0.0201]
A+0.1 gives me 0.001*(A), also, say [0.0740 0.0850 0.0550; 0.0830 0.0820 0.0200]
even after A=double(A), then do A+1, it gives me the same values as listed in 1
Can anyone help me to solve this? I read 2 matrix from txt files, for example, two 2×3 matrix A=[740 850 550 ; 830 820 200 ] B=[742 851 552 ; 835 818 220 ]
and want to calculate A-B, but in the 2×3 ans, all nubmers are zeros ans= [0 0 0; 0 0 0]
I tried to convert them to double using double(A), double(B), but it doesn’t work
Also I tried several things
A+1 gives me 0.001*(A+1), also, say [0.0741 0.0851 0.0551; 0.0831 0.0821 0.0201]
A+0.1 gives me 0.001*(A), also, say [0.0740 0.0850 0.0550; 0.0830 0.0820 0.0200]
even after A=double(A), then do A+1, it gives me the same values as listed in 1
Can anyone help me to solve this? double, matlab, unit MATLAB Answers — New Questions
Refreshing pivot tables
I updated my database and attempted to refresh my pivot tables. I went into Pivot Table Analyze and clicked on Refresh All and nothing happens. Help
I updated my database and attempted to refresh my pivot tables. I went into Pivot Table Analyze and clicked on Refresh All and nothing happens. Help Read More