Category: News
How to change distance between groups of bars in a bar plot?
I have 3 sets of data that I am plotting using ‘bar’. This generates sets of grouped bars. I know one can change the width of bars such that within a group they have some gap between them.
But how do I change the distance between groups of bars? I could not find any solution online, except calculating the x coordinates by yourself and plotting each dataset separately. If that’s the only way, Mathworks should do something about it!I have 3 sets of data that I am plotting using ‘bar’. This generates sets of grouped bars. I know one can change the width of bars such that within a group they have some gap between them.
But how do I change the distance between groups of bars? I could not find any solution online, except calculating the x coordinates by yourself and plotting each dataset separately. If that’s the only way, Mathworks should do something about it! I have 3 sets of data that I am plotting using ‘bar’. This generates sets of grouped bars. I know one can change the width of bars such that within a group they have some gap between them.
But how do I change the distance between groups of bars? I could not find any solution online, except calculating the x coordinates by yourself and plotting each dataset separately. If that’s the only way, Mathworks should do something about it! barplot, group, bar, width, distance MATLAB Answers — New Questions
Is it possible to make ‘uisetcolor’ integrated in GUI?
Hi
I’m trying to build ‘uisetcolor’ into my GUI.
At the moment, if I run my GUI, the ‘uisetcolor’ pops up in a seperate window. See below.
What do I need to do in order to make it shown in my GUI interface rather than a stand-alone window?
If you noticed that my uisetcolor interface looks different to the one you know that is because i’m using matlab 2018a so uisetcolor is missing the gradient color picker which is only available in the later matlab version such as 2018b.
Please help.Hi
I’m trying to build ‘uisetcolor’ into my GUI.
At the moment, if I run my GUI, the ‘uisetcolor’ pops up in a seperate window. See below.
What do I need to do in order to make it shown in my GUI interface rather than a stand-alone window?
If you noticed that my uisetcolor interface looks different to the one you know that is because i’m using matlab 2018a so uisetcolor is missing the gradient color picker which is only available in the later matlab version such as 2018b.
Please help. Hi
I’m trying to build ‘uisetcolor’ into my GUI.
At the moment, if I run my GUI, the ‘uisetcolor’ pops up in a seperate window. See below.
What do I need to do in order to make it shown in my GUI interface rather than a stand-alone window?
If you noticed that my uisetcolor interface looks different to the one you know that is because i’m using matlab 2018a so uisetcolor is missing the gradient color picker which is only available in the later matlab version such as 2018b.
Please help. uisetcolor, color picker MATLAB Answers — New Questions
Test connection error in the setup process of Arduino support package for Simulink with Arduino Nano 33 BLE board
Hello Everyone,
I’m facing an error with the last step of the setup process in Arduino Support Package for Simulink. In the Test Connection, the Build is done successfully while the Download (ensures the connection between PC and board) fails. I tried solving the issue by following: Post 1 and Post 2 but the issue still persists. The log file outputs:
Sketch uses 924 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
�[92mUsed platform�[0m �[92mVersion�[0m �[90mPath�[0m
�[93marduino:avr�[0m 1.8.3 �[90mC:ProgramDataMATLABSupportPackagesR2024aaCLIdatapackagesarduinohardwareavr1.8.3�[0m
Any suggestions?
Thank you!Hello Everyone,
I’m facing an error with the last step of the setup process in Arduino Support Package for Simulink. In the Test Connection, the Build is done successfully while the Download (ensures the connection between PC and board) fails. I tried solving the issue by following: Post 1 and Post 2 but the issue still persists. The log file outputs:
Sketch uses 924 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
�[92mUsed platform�[0m �[92mVersion�[0m �[90mPath�[0m
�[93marduino:avr�[0m 1.8.3 �[90mC:ProgramDataMATLABSupportPackagesR2024aaCLIdatapackagesarduinohardwareavr1.8.3�[0m
Any suggestions?
Thank you! Hello Everyone,
I’m facing an error with the last step of the setup process in Arduino Support Package for Simulink. In the Test Connection, the Build is done successfully while the Download (ensures the connection between PC and board) fails. I tried solving the issue by following: Post 1 and Post 2 but the issue still persists. The log file outputs:
Sketch uses 924 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
�[92mUsed platform�[0m �[92mVersion�[0m �[90mPath�[0m
�[93marduino:avr�[0m 1.8.3 �[90mC:ProgramDataMATLABSupportPackagesR2024aaCLIdatapackagesarduinohardwareavr1.8.3�[0m
Any suggestions?
Thank you! arduino, simulink MATLAB Answers — New Questions
pie chart creation with name (number) and corresponding percentage
Hi! I would like to create a pie chart like in the present demo:
x = [1,2,3];
p = pie(x);
pText = findobj(p,’Type’,’text’);
percentValues = get(pText,’String’);
txt = {‘Item A: ‘;’Item B: ‘;’Item C: ‘};
combinedtxt = strcat(txt,percentValues);
pText(1).String = combinedtxt(1);
pText(2).String = combinedtxt(2);
pText(3).String = combinedtxt(3);
How can I achieve the same result with my data?
I tried it this way:
number = [78;79;80;81;82;83;84;85;86;87;88]’;
value = [4509;5239;6400;9074;11047;13147;15137;13909;6354;1152;183]’;
number2 = {};
for K = 1:height(number)
number1 = sprintf(‘%.0f’,number(K));
number2 = [number2,{number1}];
end
number2 = number2.’;
p = pie(value);
pText = findobj(p,’Type’,’text’);
percentValues = get(pText,’String’);
combinedtxt = strcat(number2,percentValues);
for K = 1:height(value)
pText(K).String = combinedtxt(K);
endHi! I would like to create a pie chart like in the present demo:
x = [1,2,3];
p = pie(x);
pText = findobj(p,’Type’,’text’);
percentValues = get(pText,’String’);
txt = {‘Item A: ‘;’Item B: ‘;’Item C: ‘};
combinedtxt = strcat(txt,percentValues);
pText(1).String = combinedtxt(1);
pText(2).String = combinedtxt(2);
pText(3).String = combinedtxt(3);
How can I achieve the same result with my data?
I tried it this way:
number = [78;79;80;81;82;83;84;85;86;87;88]’;
value = [4509;5239;6400;9074;11047;13147;15137;13909;6354;1152;183]’;
number2 = {};
for K = 1:height(number)
number1 = sprintf(‘%.0f’,number(K));
number2 = [number2,{number1}];
end
number2 = number2.’;
p = pie(value);
pText = findobj(p,’Type’,’text’);
percentValues = get(pText,’String’);
combinedtxt = strcat(number2,percentValues);
for K = 1:height(value)
pText(K).String = combinedtxt(K);
end Hi! I would like to create a pie chart like in the present demo:
x = [1,2,3];
p = pie(x);
pText = findobj(p,’Type’,’text’);
percentValues = get(pText,’String’);
txt = {‘Item A: ‘;’Item B: ‘;’Item C: ‘};
combinedtxt = strcat(txt,percentValues);
pText(1).String = combinedtxt(1);
pText(2).String = combinedtxt(2);
pText(3).String = combinedtxt(3);
How can I achieve the same result with my data?
I tried it this way:
number = [78;79;80;81;82;83;84;85;86;87;88]’;
value = [4509;5239;6400;9074;11047;13147;15137;13909;6354;1152;183]’;
number2 = {};
for K = 1:height(number)
number1 = sprintf(‘%.0f’,number(K));
number2 = [number2,{number1}];
end
number2 = number2.’;
p = pie(value);
pText = findobj(p,’Type’,’text’);
percentValues = get(pText,’String’);
combinedtxt = strcat(number2,percentValues);
for K = 1:height(value)
pText(K).String = combinedtxt(K);
end pie, chart MATLAB Answers — New Questions
State Flow C Action Language Bitwise Operators
I am trying to use bitwise operators to AND as well as OR an uint value with an int value in stateflow with C action language. I need to use 32 bit values but the results appear to be incorrect with 32 bit values, while 8-, 16-, and 64- bit values all seem to give correct results. Image below shows the stateflow chart and correct results using 16 bit values vs incorrect results with 32 bit values. Am I missing something? Or is this a known issue?I am trying to use bitwise operators to AND as well as OR an uint value with an int value in stateflow with C action language. I need to use 32 bit values but the results appear to be incorrect with 32 bit values, while 8-, 16-, and 64- bit values all seem to give correct results. Image below shows the stateflow chart and correct results using 16 bit values vs incorrect results with 32 bit values. Am I missing something? Or is this a known issue? I am trying to use bitwise operators to AND as well as OR an uint value with an int value in stateflow with C action language. I need to use 32 bit values but the results appear to be incorrect with 32 bit values, while 8-, 16-, and 64- bit values all seem to give correct results. Image below shows the stateflow chart and correct results using 16 bit values vs incorrect results with 32 bit values. Am I missing something? Or is this a known issue? bitwise, stateflow, int, uint, and, or MATLAB Answers — New Questions
Need input on 508 compliant colors in MATLAB
Hi
I am putting together a training class to inform fellows/staff where to find the 508 compliant accessible color schemes in
various programs. I would like to include MATLAB in the class.
I don’t use the program myself, so can you point me to a set or multiple sets of colors that are 508 compliant?
Thank you,
Deb CroteauHi
I am putting together a training class to inform fellows/staff where to find the 508 compliant accessible color schemes in
various programs. I would like to include MATLAB in the class.
I don’t use the program myself, so can you point me to a set or multiple sets of colors that are 508 compliant?
Thank you,
Deb Croteau Hi
I am putting together a training class to inform fellows/staff where to find the 508 compliant accessible color schemes in
various programs. I would like to include MATLAB in the class.
I don’t use the program myself, so can you point me to a set or multiple sets of colors that are 508 compliant?
Thank you,
Deb Croteau 508 color compliant schemes MATLAB Answers — New Questions
How do I fix a duplicate name error ?
I am using the simBiology builder app on matlab. I keep receiving an error on one of my models of a duplicate name error ( names are SSRI, SERT, 5-HT ) However, it doesn’t say how to fix it. I have to models in this project and only one has this issue. How do I fix it?I am using the simBiology builder app on matlab. I keep receiving an error on one of my models of a duplicate name error ( names are SSRI, SERT, 5-HT ) However, it doesn’t say how to fix it. I have to models in this project and only one has this issue. How do I fix it? I am using the simBiology builder app on matlab. I keep receiving an error on one of my models of a duplicate name error ( names are SSRI, SERT, 5-HT ) However, it doesn’t say how to fix it. I have to models in this project and only one has this issue. How do I fix it? matlab, simbiology MATLAB Answers — New Questions
Converting a three-column set of data to xyf matrix suitable for a contour plot
I have a set of data (the output of a CFD calculation) that consists of three columns x and y showing location and a third column that we call f which contains the values of the variable calculated for every specific xy location. I want to convert this array to a 2D matrix where x and y are now in the horizontal and vertical directions. Some data points simply do not exist because they are outside of the domain boundaries.
So basically, what I need to do is this (where the black cells are the ones for which the original dataset has no values.):I have a set of data (the output of a CFD calculation) that consists of three columns x and y showing location and a third column that we call f which contains the values of the variable calculated for every specific xy location. I want to convert this array to a 2D matrix where x and y are now in the horizontal and vertical directions. Some data points simply do not exist because they are outside of the domain boundaries.
So basically, what I need to do is this (where the black cells are the ones for which the original dataset has no values.): I have a set of data (the output of a CFD calculation) that consists of three columns x and y showing location and a third column that we call f which contains the values of the variable calculated for every specific xy location. I want to convert this array to a 2D matrix where x and y are now in the horizontal and vertical directions. Some data points simply do not exist because they are outside of the domain boundaries.
So basically, what I need to do is this (where the black cells are the ones for which the original dataset has no values.): resize, columns, matrix, contours plots MATLAB Answers — New Questions
Matlab Report Generator not finding .dotx file after compiling
I’m having some issues using Report Generator to create a .docx from a .dotx template in a compiled web app. It works fine in the app designer but as soon as it is compiled and on the web app server it can no longer find the template file. I have ensured that the Template.dotx file is included in the package while compiling.
The log shows
2024-04-26 14:59:15 Error using mlreportgen.dom.Document/open
2024-04-26 14:59:15 Unable to find template: Template.dotx.
[file,path] = uiputfile(‘*.docx’, ‘Analyzed’, [app.name1 ‘_AN’]);
if isequal(file,0)
disp(‘User selected Cancel’)
else
docxname = fullfile(path,file);
end
makeDOMCompilable();
import mlreportgen.dom.*
import mlreportgen.report.*
D = Document(docxname,’docx’,’Template.dotx’);
open(D);
moveToNextHole(D);
append(D, info);…….
close(D)I’m having some issues using Report Generator to create a .docx from a .dotx template in a compiled web app. It works fine in the app designer but as soon as it is compiled and on the web app server it can no longer find the template file. I have ensured that the Template.dotx file is included in the package while compiling.
The log shows
2024-04-26 14:59:15 Error using mlreportgen.dom.Document/open
2024-04-26 14:59:15 Unable to find template: Template.dotx.
[file,path] = uiputfile(‘*.docx’, ‘Analyzed’, [app.name1 ‘_AN’]);
if isequal(file,0)
disp(‘User selected Cancel’)
else
docxname = fullfile(path,file);
end
makeDOMCompilable();
import mlreportgen.dom.*
import mlreportgen.report.*
D = Document(docxname,’docx’,’Template.dotx’);
open(D);
moveToNextHole(D);
append(D, info);…….
close(D) I’m having some issues using Report Generator to create a .docx from a .dotx template in a compiled web app. It works fine in the app designer but as soon as it is compiled and on the web app server it can no longer find the template file. I have ensured that the Template.dotx file is included in the package while compiling.
The log shows
2024-04-26 14:59:15 Error using mlreportgen.dom.Document/open
2024-04-26 14:59:15 Unable to find template: Template.dotx.
[file,path] = uiputfile(‘*.docx’, ‘Analyzed’, [app.name1 ‘_AN’]);
if isequal(file,0)
disp(‘User selected Cancel’)
else
docxname = fullfile(path,file);
end
makeDOMCompilable();
import mlreportgen.dom.*
import mlreportgen.report.*
D = Document(docxname,’docx’,’Template.dotx’);
open(D);
moveToNextHole(D);
append(D, info);…….
close(D) report generator, compiler, web app, template MATLAB Answers — New Questions
What these requirement for Excel 2019 certified exam really means?
I am thinking about taking an Excel 2019 certified exam proctored by Microsoft.
But I can’t make up what the following instruction really means. Can anyone kindly clear up what it means? What identification documents are they talking about?
Take a clear photo of your identification documents. This step is required for validating your identity at the time of testing. If the photo isn’t clear, the proctor won’t allow you to take the test. There are no exceptions to this rule
Also can’t have System Test for Certification online. It’s not working. How do I know my system is compatible?
Do I need to install Excel 2019 if I decide to take the test online staying from home?
I am thinking about taking an Excel 2019 certified exam proctored by Microsoft. But I can’t make up what the following instruction really means. Can anyone kindly clear up what it means? What identification documents are they talking about? Take a clear photo of your identification documents. This step is required for validating your identity at the time of testing. If the photo isn’t clear, the proctor won’t allow you to take the test. There are no exceptions to this rule Also can’t have System Test for Certification online. It’s not working. How do I know my system is compatible? Do I need to install Excel 2019 if I decide to take the test online staying from home? Read More
The generated files are mysteriously deleted
I developed an application that, after running on a Windows computer, generates some files. The files are saved to an internal shared server running Windows Server 2012. However, occasionally, some files are mysteriously deleted after the program runs. Not all generated files are deleted. I initially thought they were being deleted as viruses, but disabling security protection on the Windows server did not help.
Could you please help me explore the possible causes and solutions?
I developed an application that, after running on a Windows computer, generates some files. The files are saved to an internal shared server running Windows Server 2012. However, occasionally, some files are mysteriously deleted after the program runs. Not all generated files are deleted. I initially thought they were being deleted as viruses, but disabling security protection on the Windows server did not help. Could you please help me explore the possible causes and solutions? Read More
Microsoft Defender will not let me log in on Windows 11
I have a subscription to the Personal Microsoft 365 plan which includes Microsoft Defender. When I try logging into Microsoft Defender on my Windows PC, I receive an error message stating “Couldn’t sign in to Microsoft Defender. Something went wrong-please try again later”. I have been having this issue for several months now. I have recently contacted Microsoft Tech support who just directed me to this community. The tech support representative mentioned that others may have experienced similar issues as mine. I would appreciate if anyone could advise.
My PC is running Windows 11 and is up to date on updates. All of my 365 applications are also up to date. I have also tried running the repair tool on Microsoft Defender in addition to uninstalling and reinstalling the application.
The tech support representative mentioned something to me about the issue could be because I am using a personal email account for my login for Microsoft Defender. I did not fully understand why that would be the issue. I would like to note that I have no issue logging into Microsoft Defender on my Android phone. The problem appears to only occur on my PC and only for the Microsoft Defender app. All other apps that come with my 365 subscription use the same login and appear to be working fine.
I have a subscription to the Personal Microsoft 365 plan which includes Microsoft Defender. When I try logging into Microsoft Defender on my Windows PC, I receive an error message stating “Couldn’t sign in to Microsoft Defender. Something went wrong-please try again later”. I have been having this issue for several months now. I have recently contacted Microsoft Tech support who just directed me to this community. The tech support representative mentioned that others may have experienced similar issues as mine. I would appreciate if anyone could advise. My PC is running Windows 11 and is up to date on updates. All of my 365 applications are also up to date. I have also tried running the repair tool on Microsoft Defender in addition to uninstalling and reinstalling the application. The tech support representative mentioned something to me about the issue could be because I am using a personal email account for my login for Microsoft Defender. I did not fully understand why that would be the issue. I would like to note that I have no issue logging into Microsoft Defender on my Android phone. The problem appears to only occur on my PC and only for the Microsoft Defender app. All other apps that come with my 365 subscription use the same login and appear to be working fine. Read More
Azure Data Factory CDC-Update and Delete of a row
Team,
I am exploring Azure Data Factory CDC and I am unable to figure out if there is a way to do update and delete of a row.
In the properties, I can see it has updateable and upsertable, any idea how to set this from the ADF UI?
Please let me know if it is possible.
Thanks
Team,I am exploring Azure Data Factory CDC and I am unable to figure out if there is a way to do update and delete of a row.In the properties, I can see it has updateable and upsertable, any idea how to set this from the ADF UI? Please let me know if it is possible.Thanks Read More
SharePoint document embeds stuck on Sign In screen [worldwide bug + reproducible]
Iframe embeds of SharePoint documents (Excel, PowerPoint, Word etc) show the “Sign In” screen regardless of access permissions. Clicking sign in opens a popup, authenticates, closes popup, and no redirection occurs.
Console shows request errors for /_api/contextinfo and /_api/web/Language
This bug is global/worldwide and is not due to any local setup or tenant configuration. Has been introduced in the past few days. Same bug described here: Unable to Embed SharePoint Document.
Steps to reproduce:
1. Chrome or Edge: open any SharePoint document (Excel, PowerPoint, Word).
2. File, Share, Embed.
3. Copy-paste the iframe embed code into a new JSFiddle.
4. Click “Sign In”.
5. Open dev console to see the errors.
Seems to work in Firefox, so could be a Chromium issue.
Is there an official method to report bugs to Microsoft or are these forums the only option?
Iframe embeds of SharePoint documents (Excel, PowerPoint, Word etc) show the “Sign In” screen regardless of access permissions. Clicking sign in opens a popup, authenticates, closes popup, and no redirection occurs. Console shows request errors for /_api/contextinfo and /_api/web/Language This bug is global/worldwide and is not due to any local setup or tenant configuration. Has been introduced in the past few days. Same bug described here: Unable to Embed SharePoint Document. Steps to reproduce: 1. Chrome or Edge: open any SharePoint document (Excel, PowerPoint, Word).2. File, Share, Embed.3. Copy-paste the iframe embed code into a new JSFiddle.4. Click “Sign In”.5. Open dev console to see the errors. Seems to work in Firefox, so could be a Chromium issue. Is there an official method to report bugs to Microsoft or are these forums the only option? Read More
Microsoft Teams SMB at the Microsoft 365 Community Conference (Apr 30-May 2, 2024)
Join product leaders from our Teams SMB team at the Microsoft 365 Community Conference in Orlando, FL, April 30 – May 2, 2024.
The following sessions will be tailored to the SMB audience:
Microsoft Teams: Small business’s big partner in success with Abhijat Kanade and Arun Das | Thursday, May 2, 8:00am – 9:00am
Learn about the Microsoft Global Community Initiative, SMB Community, and M365 Champions Programs with Tiffany Lee | Tuesday, April 30, 8:00am – 9:15am
All conference sessions and event details can be found here on our Teams blog: https://techcommunity.microsoft.com/t5/microsoft-teams-blog/microsoft-teams-at-the-microsoft-365-community-conference/ba-p/4105608
We hope to see some of you there! Please come back to this forum to chat with us after the conference!
Join product leaders from our Teams SMB team at the Microsoft 365 Community Conference in Orlando, FL, April 30 – May 2, 2024.
The following sessions will be tailored to the SMB audience:
Microsoft Teams: Small business’s big partner in success with Abhijat Kanade and Arun Das | Thursday, May 2, 8:00am – 9:00am
Learn about the Microsoft Global Community Initiative, SMB Community, and M365 Champions Programs with Tiffany Lee | Tuesday, April 30, 8:00am – 9:15am
All conference sessions and event details can be found here on our Teams blog: https://techcommunity.microsoft.com/t5/microsoft-teams-blog/microsoft-teams-at-the-microsoft-365-community-conference/ba-p/4105608
We hope to see some of you there! Please come back to this forum to chat with us after the conference! Read More
problem onn numerical solution
= 0.3; % Rayon de lissage
dx=0.3;
N =floor(1/dx);
x =0:dx:(pi/sqrt(3)); % Positions des particules
dt = 1/4;
t = 0:dt:1;
M = length(t) – 1;
% Initialisation de la solution approchée et de la matrice A
A = zeros(N, N);
b=zeros(N,1);
uapp=zeros(N,1);
%sol et cond exacte
u_exact = @(x) cos(sqrt(3)*x);
% Construction de la matrice A et du vecteur b
for i = 1:N
for j =N
r_ij = abs(x(i) – x(j));
if r_ij <= h
d2W_dx2 = second_derivative_monaghan_kernel(r_ij, h);
W_value = monaghan_kernel(r_ij, h);
A(i, j) = (u_exact(x(j))- u_exact(x(i))) * d2W_dx2;
b(i) = -3 * u_exact(x(j)) * W_value ;
end
end
end
u_app(1)=1;
u_app(N)=u_exact(pi/sqrt(3));
uapp = bA;
uapp = [0; uapp];
% Affichage des résultats
plot(x , uapp, ‘r’);
hold on;
plot(x, u_exact(x), ‘b–‘);
xlabel(‘x’);
ylabel(‘u’);
legend(‘Solution approchée (SPH)’, ‘Solution exacte’);
title(‘Solution approchée et exacte par SPH’);
grid on;
% Fonctions du noyau de Monaghan
function W_value =monaghan_kernel(r_ij, h)
C= (1/ h);
if r_ij < h
W_value =C*((2 / 3) – (r_ij / h)^2 +(1/2 *(r_ij / h)^3));
elseif r_ij<2*h
W_value =C*((1/6)*(2-(r_ij / h))^3);
else
W_value=0;
end
end
function d2W_dx2 = second_derivative_monaghan_kernel(r_ij, h)
C = (1 / h); % Corrected the denominator
if r_ij < h
d2W_dx2 = -2 * C * (1 – (3 * (r_ij / h)));
elseif r_ij < 2*h
d2W_dx2 = 2 * C * (2 – (r_ij / h)); % Removed extra characters
else
d2W_dx2 = 0;
end
end
I have a problem simulataing a numerical solution for this program
Ineed some help urgent= 0.3; % Rayon de lissage
dx=0.3;
N =floor(1/dx);
x =0:dx:(pi/sqrt(3)); % Positions des particules
dt = 1/4;
t = 0:dt:1;
M = length(t) – 1;
% Initialisation de la solution approchée et de la matrice A
A = zeros(N, N);
b=zeros(N,1);
uapp=zeros(N,1);
%sol et cond exacte
u_exact = @(x) cos(sqrt(3)*x);
% Construction de la matrice A et du vecteur b
for i = 1:N
for j =N
r_ij = abs(x(i) – x(j));
if r_ij <= h
d2W_dx2 = second_derivative_monaghan_kernel(r_ij, h);
W_value = monaghan_kernel(r_ij, h);
A(i, j) = (u_exact(x(j))- u_exact(x(i))) * d2W_dx2;
b(i) = -3 * u_exact(x(j)) * W_value ;
end
end
end
u_app(1)=1;
u_app(N)=u_exact(pi/sqrt(3));
uapp = bA;
uapp = [0; uapp];
% Affichage des résultats
plot(x , uapp, ‘r’);
hold on;
plot(x, u_exact(x), ‘b–‘);
xlabel(‘x’);
ylabel(‘u’);
legend(‘Solution approchée (SPH)’, ‘Solution exacte’);
title(‘Solution approchée et exacte par SPH’);
grid on;
% Fonctions du noyau de Monaghan
function W_value =monaghan_kernel(r_ij, h)
C= (1/ h);
if r_ij < h
W_value =C*((2 / 3) – (r_ij / h)^2 +(1/2 *(r_ij / h)^3));
elseif r_ij<2*h
W_value =C*((1/6)*(2-(r_ij / h))^3);
else
W_value=0;
end
end
function d2W_dx2 = second_derivative_monaghan_kernel(r_ij, h)
C = (1 / h); % Corrected the denominator
if r_ij < h
d2W_dx2 = -2 * C * (1 – (3 * (r_ij / h)));
elseif r_ij < 2*h
d2W_dx2 = 2 * C * (2 – (r_ij / h)); % Removed extra characters
else
d2W_dx2 = 0;
end
end
I have a problem simulataing a numerical solution for this program
Ineed some help urgent = 0.3; % Rayon de lissage
dx=0.3;
N =floor(1/dx);
x =0:dx:(pi/sqrt(3)); % Positions des particules
dt = 1/4;
t = 0:dt:1;
M = length(t) – 1;
% Initialisation de la solution approchée et de la matrice A
A = zeros(N, N);
b=zeros(N,1);
uapp=zeros(N,1);
%sol et cond exacte
u_exact = @(x) cos(sqrt(3)*x);
% Construction de la matrice A et du vecteur b
for i = 1:N
for j =N
r_ij = abs(x(i) – x(j));
if r_ij <= h
d2W_dx2 = second_derivative_monaghan_kernel(r_ij, h);
W_value = monaghan_kernel(r_ij, h);
A(i, j) = (u_exact(x(j))- u_exact(x(i))) * d2W_dx2;
b(i) = -3 * u_exact(x(j)) * W_value ;
end
end
end
u_app(1)=1;
u_app(N)=u_exact(pi/sqrt(3));
uapp = bA;
uapp = [0; uapp];
% Affichage des résultats
plot(x , uapp, ‘r’);
hold on;
plot(x, u_exact(x), ‘b–‘);
xlabel(‘x’);
ylabel(‘u’);
legend(‘Solution approchée (SPH)’, ‘Solution exacte’);
title(‘Solution approchée et exacte par SPH’);
grid on;
% Fonctions du noyau de Monaghan
function W_value =monaghan_kernel(r_ij, h)
C= (1/ h);
if r_ij < h
W_value =C*((2 / 3) – (r_ij / h)^2 +(1/2 *(r_ij / h)^3));
elseif r_ij<2*h
W_value =C*((1/6)*(2-(r_ij / h))^3);
else
W_value=0;
end
end
function d2W_dx2 = second_derivative_monaghan_kernel(r_ij, h)
C = (1 / h); % Corrected the denominator
if r_ij < h
d2W_dx2 = -2 * C * (1 – (3 * (r_ij / h)));
elseif r_ij < 2*h
d2W_dx2 = 2 * C * (2 – (r_ij / h)); % Removed extra characters
else
d2W_dx2 = 0;
end
end
I have a problem simulataing a numerical solution for this program
Ineed some help urgent optimization, numerical integration, differential equations MATLAB Answers — New Questions
The helptool doc.m function is returning an error
I am trying to use the internal doc.m function for finding the help guide to native MATLAB functions. When I call it, instead of pulling up a help page, it returns a series of error messages. I have tried using the which function to make sure that I am trying to call the appropriate function, which confirmed that I do not have any conflicts with other functions that I have written personally. Does anyone know why this might be happening?
>> doc find
Error using split (line 9)
First argument must be text.
Error in matlab.internal.doc.url.DocContentPage/splitPath (line 139)
pathParts = split(pathParts,"/"|"")’;
Error in matlab.internal.doc.url.DocContentPage/buildUrl (line 111)
helpLocation = matlab.internal.doc.url.DocContentPage.splitPath(obj.Product.HelpLocation);
Error in matlab.internal.doc.url.DocPage/getNavigationUrl (line 34)
url = obj.buildUrl;
Error in matlab.internal.doc.ui.DocPageLauncher/openDocPage (line 30)
success = openBrowser(obj.Handler, getNavigationUrl(activePage));
Error in doc (line 79)
launcher.openDocPage;I am trying to use the internal doc.m function for finding the help guide to native MATLAB functions. When I call it, instead of pulling up a help page, it returns a series of error messages. I have tried using the which function to make sure that I am trying to call the appropriate function, which confirmed that I do not have any conflicts with other functions that I have written personally. Does anyone know why this might be happening?
>> doc find
Error using split (line 9)
First argument must be text.
Error in matlab.internal.doc.url.DocContentPage/splitPath (line 139)
pathParts = split(pathParts,"/"|"")’;
Error in matlab.internal.doc.url.DocContentPage/buildUrl (line 111)
helpLocation = matlab.internal.doc.url.DocContentPage.splitPath(obj.Product.HelpLocation);
Error in matlab.internal.doc.url.DocPage/getNavigationUrl (line 34)
url = obj.buildUrl;
Error in matlab.internal.doc.ui.DocPageLauncher/openDocPage (line 30)
success = openBrowser(obj.Handler, getNavigationUrl(activePage));
Error in doc (line 79)
launcher.openDocPage; I am trying to use the internal doc.m function for finding the help guide to native MATLAB functions. When I call it, instead of pulling up a help page, it returns a series of error messages. I have tried using the which function to make sure that I am trying to call the appropriate function, which confirmed that I do not have any conflicts with other functions that I have written personally. Does anyone know why this might be happening?
>> doc find
Error using split (line 9)
First argument must be text.
Error in matlab.internal.doc.url.DocContentPage/splitPath (line 139)
pathParts = split(pathParts,"/"|"")’;
Error in matlab.internal.doc.url.DocContentPage/buildUrl (line 111)
helpLocation = matlab.internal.doc.url.DocContentPage.splitPath(obj.Product.HelpLocation);
Error in matlab.internal.doc.url.DocPage/getNavigationUrl (line 34)
url = obj.buildUrl;
Error in matlab.internal.doc.ui.DocPageLauncher/openDocPage (line 30)
success = openBrowser(obj.Handler, getNavigationUrl(activePage));
Error in doc (line 79)
launcher.openDocPage; doc MATLAB Answers — New Questions
Comparing coefficients and solving equation
Hello everyone,
I would like to find the values of variables comparing coefficients in equation. Let’s have a look at an easy example.
x^2 + 2*x + 5 = (b+4*a)*x^2 + (5*a+b)*x + (-b+2*a)
May someone help me with finding ‘a’ and ‘b’ value?
ThanksHello everyone,
I would like to find the values of variables comparing coefficients in equation. Let’s have a look at an easy example.
x^2 + 2*x + 5 = (b+4*a)*x^2 + (5*a+b)*x + (-b+2*a)
May someone help me with finding ‘a’ and ‘b’ value?
Thanks Hello everyone,
I would like to find the values of variables comparing coefficients in equation. Let’s have a look at an easy example.
x^2 + 2*x + 5 = (b+4*a)*x^2 + (5*a+b)*x + (-b+2*a)
May someone help me with finding ‘a’ and ‘b’ value?
Thanks equation MATLAB Answers — New Questions
Non linear constrain to multi objective integer genetic algorithm
Hello all,
I am trying to set up a multibjective optimization in ga that the possible candidates for the x array have different values (it is an optimal sensor placement problem thus I cannot have the same sensor in the same grid more than once).
When I use the single objcetive function "ga" and define nonlcon = @(x) deal(any(abs(diff(x(1:length(lb)/2))) ~= 1), []) the optimization works fine. (only the first half of the array regards the sensors the rest is the strain component so the values dont have to be unique)
However for the case of "gamultiobj" the non linear constrain does not seem to be taken into account.
Have you ever had such an issue?
ThanksHello all,
I am trying to set up a multibjective optimization in ga that the possible candidates for the x array have different values (it is an optimal sensor placement problem thus I cannot have the same sensor in the same grid more than once).
When I use the single objcetive function "ga" and define nonlcon = @(x) deal(any(abs(diff(x(1:length(lb)/2))) ~= 1), []) the optimization works fine. (only the first half of the array regards the sensors the rest is the strain component so the values dont have to be unique)
However for the case of "gamultiobj" the non linear constrain does not seem to be taken into account.
Have you ever had such an issue?
Thanks Hello all,
I am trying to set up a multibjective optimization in ga that the possible candidates for the x array have different values (it is an optimal sensor placement problem thus I cannot have the same sensor in the same grid more than once).
When I use the single objcetive function "ga" and define nonlcon = @(x) deal(any(abs(diff(x(1:length(lb)/2))) ~= 1), []) the optimization works fine. (only the first half of the array regards the sensors the rest is the strain component so the values dont have to be unique)
However for the case of "gamultiobj" the non linear constrain does not seem to be taken into account.
Have you ever had such an issue?
Thanks gamultiobj, nonlcon MATLAB Answers — New Questions
Matrix dimensions must agree
Hello i am trying to use ‘pcolor’ command and error keeps popping up that ‘ matrix dimensions must agree ‘ i am a beginner and clueless on how to fix this if anyone could help id appreciate it , Thank you
ls *.asc
load(‘CTDGrpA1_conv_binav_asc.asc’)
load(‘CTDGrpA2_conv_binav_asc.asc’)
load(‘CTDGrpA3_conv_binav_asc.asc’)
load(‘CTDGrpA4_conv_binav_asc.asc’)
load(‘CTDGrpA5_conv_binav_asc.asc’)
load(‘CTDGrpA6_conv_binav_asc.asc’)
load(‘CTDGrpA7_conv_binav_asc.asc’)
load(‘CTDGrpA8_conv_binav_asc.asc’)
load(‘CTDGrpA9_conv_binav_asc.asc’)
T1=CTDGrpA1_conv_binav_asc(:,2);S1=CTDGrpA1_conv_binav_asc(:,3);depth1=CTDGrpA1_conv_binav_asc(:,1);
T2=CTDGrpA2_conv_binav_asc(1:13,2);S2=CTDGrpA2_conv_binav_asc(1:13,3);depth2=CTDGrpA2_conv_binav_asc(1:13,1);
T3=CTDGrpA3_conv_binav_asc(1:14,2);S3=CTDGrpA3_conv_binav_asc(1:14,3);depth3=CTDGrpA3_conv_binav_asc(1:14,1);
T4=CTDGrpA4_conv_binav_asc(1:14,2);S4=CTDGrpA4_conv_binav_asc(1:14,3);depth4=CTDGrpA4_conv_binav_asc(1:14,1);
T5=CTDGrpA5_conv_binav_asc(1:15,2);S5=CTDGrpA5_conv_binav_asc(1:15,3);depth5=CTDGrpA5_conv_binav_asc(1:15,1);
T6=CTDGrpA6_conv_binav_asc(1:12,2);S6=CTDGrpA6_conv_binav_asc(1:12,3);depth6=CTDGrpA6_conv_binav_asc(1:12,1);
T7=CTDGrpA7_conv_binav_asc(1:11,2);S7=CTDGrpA7_conv_binav_asc(1:11,3);depth7=CTDGrpA7_conv_binav_asc(1:11,1);
T8=CTDGrpA8_conv_binav_asc(1:8,2);S8=CTDGrpA8_conv_binav_asc(1:8,3);depth8=CTDGrpA8_conv_binav_asc(1:8,1);
T9=CTDGrpA9_conv_binav_asc(1:5,2);S9=CTDGrpA9_conv_binav_asc(1:5,3);depth9=CTDGrpA9_conv_binav_asc(1:5,1);
max_length=29;
Temperature1=[T1; nan(max_length-length(T1),1)];
Temperature2=[T2; nan(max_length-length(T2),1)];
Temperature3=[T3; nan(max_length-length(T3),1)];
Temperature4=[T4; nan(max_length-length(T4),1)];
Temperature5=[T5; nan(max_length-length(T5),1)];
Temperature6=[T6; nan(max_length-length(T6),1)];
Temperature7=[T7; nan(max_length-length(T7),1)];
Temperature8=[T8; nan(max_length-length(T8),1)];
Temperature9=[T9; nan(max_length-length(T9),1)];
whos Temperature*
Temperature_Matrix=[Temperature1 Temperature2 Temperature3 Temperature4 Temperature5 Temperature6 Temperature7 Temperature8 Temperature9];
Depth=depth5;
station=1:9;
figure
pcolor(station,Depth,Temperature_Matrix)Hello i am trying to use ‘pcolor’ command and error keeps popping up that ‘ matrix dimensions must agree ‘ i am a beginner and clueless on how to fix this if anyone could help id appreciate it , Thank you
ls *.asc
load(‘CTDGrpA1_conv_binav_asc.asc’)
load(‘CTDGrpA2_conv_binav_asc.asc’)
load(‘CTDGrpA3_conv_binav_asc.asc’)
load(‘CTDGrpA4_conv_binav_asc.asc’)
load(‘CTDGrpA5_conv_binav_asc.asc’)
load(‘CTDGrpA6_conv_binav_asc.asc’)
load(‘CTDGrpA7_conv_binav_asc.asc’)
load(‘CTDGrpA8_conv_binav_asc.asc’)
load(‘CTDGrpA9_conv_binav_asc.asc’)
T1=CTDGrpA1_conv_binav_asc(:,2);S1=CTDGrpA1_conv_binav_asc(:,3);depth1=CTDGrpA1_conv_binav_asc(:,1);
T2=CTDGrpA2_conv_binav_asc(1:13,2);S2=CTDGrpA2_conv_binav_asc(1:13,3);depth2=CTDGrpA2_conv_binav_asc(1:13,1);
T3=CTDGrpA3_conv_binav_asc(1:14,2);S3=CTDGrpA3_conv_binav_asc(1:14,3);depth3=CTDGrpA3_conv_binav_asc(1:14,1);
T4=CTDGrpA4_conv_binav_asc(1:14,2);S4=CTDGrpA4_conv_binav_asc(1:14,3);depth4=CTDGrpA4_conv_binav_asc(1:14,1);
T5=CTDGrpA5_conv_binav_asc(1:15,2);S5=CTDGrpA5_conv_binav_asc(1:15,3);depth5=CTDGrpA5_conv_binav_asc(1:15,1);
T6=CTDGrpA6_conv_binav_asc(1:12,2);S6=CTDGrpA6_conv_binav_asc(1:12,3);depth6=CTDGrpA6_conv_binav_asc(1:12,1);
T7=CTDGrpA7_conv_binav_asc(1:11,2);S7=CTDGrpA7_conv_binav_asc(1:11,3);depth7=CTDGrpA7_conv_binav_asc(1:11,1);
T8=CTDGrpA8_conv_binav_asc(1:8,2);S8=CTDGrpA8_conv_binav_asc(1:8,3);depth8=CTDGrpA8_conv_binav_asc(1:8,1);
T9=CTDGrpA9_conv_binav_asc(1:5,2);S9=CTDGrpA9_conv_binav_asc(1:5,3);depth9=CTDGrpA9_conv_binav_asc(1:5,1);
max_length=29;
Temperature1=[T1; nan(max_length-length(T1),1)];
Temperature2=[T2; nan(max_length-length(T2),1)];
Temperature3=[T3; nan(max_length-length(T3),1)];
Temperature4=[T4; nan(max_length-length(T4),1)];
Temperature5=[T5; nan(max_length-length(T5),1)];
Temperature6=[T6; nan(max_length-length(T6),1)];
Temperature7=[T7; nan(max_length-length(T7),1)];
Temperature8=[T8; nan(max_length-length(T8),1)];
Temperature9=[T9; nan(max_length-length(T9),1)];
whos Temperature*
Temperature_Matrix=[Temperature1 Temperature2 Temperature3 Temperature4 Temperature5 Temperature6 Temperature7 Temperature8 Temperature9];
Depth=depth5;
station=1:9;
figure
pcolor(station,Depth,Temperature_Matrix) Hello i am trying to use ‘pcolor’ command and error keeps popping up that ‘ matrix dimensions must agree ‘ i am a beginner and clueless on how to fix this if anyone could help id appreciate it , Thank you
ls *.asc
load(‘CTDGrpA1_conv_binav_asc.asc’)
load(‘CTDGrpA2_conv_binav_asc.asc’)
load(‘CTDGrpA3_conv_binav_asc.asc’)
load(‘CTDGrpA4_conv_binav_asc.asc’)
load(‘CTDGrpA5_conv_binav_asc.asc’)
load(‘CTDGrpA6_conv_binav_asc.asc’)
load(‘CTDGrpA7_conv_binav_asc.asc’)
load(‘CTDGrpA8_conv_binav_asc.asc’)
load(‘CTDGrpA9_conv_binav_asc.asc’)
T1=CTDGrpA1_conv_binav_asc(:,2);S1=CTDGrpA1_conv_binav_asc(:,3);depth1=CTDGrpA1_conv_binav_asc(:,1);
T2=CTDGrpA2_conv_binav_asc(1:13,2);S2=CTDGrpA2_conv_binav_asc(1:13,3);depth2=CTDGrpA2_conv_binav_asc(1:13,1);
T3=CTDGrpA3_conv_binav_asc(1:14,2);S3=CTDGrpA3_conv_binav_asc(1:14,3);depth3=CTDGrpA3_conv_binav_asc(1:14,1);
T4=CTDGrpA4_conv_binav_asc(1:14,2);S4=CTDGrpA4_conv_binav_asc(1:14,3);depth4=CTDGrpA4_conv_binav_asc(1:14,1);
T5=CTDGrpA5_conv_binav_asc(1:15,2);S5=CTDGrpA5_conv_binav_asc(1:15,3);depth5=CTDGrpA5_conv_binav_asc(1:15,1);
T6=CTDGrpA6_conv_binav_asc(1:12,2);S6=CTDGrpA6_conv_binav_asc(1:12,3);depth6=CTDGrpA6_conv_binav_asc(1:12,1);
T7=CTDGrpA7_conv_binav_asc(1:11,2);S7=CTDGrpA7_conv_binav_asc(1:11,3);depth7=CTDGrpA7_conv_binav_asc(1:11,1);
T8=CTDGrpA8_conv_binav_asc(1:8,2);S8=CTDGrpA8_conv_binav_asc(1:8,3);depth8=CTDGrpA8_conv_binav_asc(1:8,1);
T9=CTDGrpA9_conv_binav_asc(1:5,2);S9=CTDGrpA9_conv_binav_asc(1:5,3);depth9=CTDGrpA9_conv_binav_asc(1:5,1);
max_length=29;
Temperature1=[T1; nan(max_length-length(T1),1)];
Temperature2=[T2; nan(max_length-length(T2),1)];
Temperature3=[T3; nan(max_length-length(T3),1)];
Temperature4=[T4; nan(max_length-length(T4),1)];
Temperature5=[T5; nan(max_length-length(T5),1)];
Temperature6=[T6; nan(max_length-length(T6),1)];
Temperature7=[T7; nan(max_length-length(T7),1)];
Temperature8=[T8; nan(max_length-length(T8),1)];
Temperature9=[T9; nan(max_length-length(T9),1)];
whos Temperature*
Temperature_Matrix=[Temperature1 Temperature2 Temperature3 Temperature4 Temperature5 Temperature6 Temperature7 Temperature8 Temperature9];
Depth=depth5;
station=1:9;
figure
pcolor(station,Depth,Temperature_Matrix) error matrix MATLAB Answers — New Questions