Month: November 2025
App Desinger: How to access Labels/Spinners via “Tags” in a custom UI component?
I have a modularized App Designer app with several custom UI components. One UI component is a setting for units (e.g. km/h – mph or deg – radiant). These settings should be applied to all other custom UI components. To reduce the implementation work I wan’t a generic solution like:
User changed the setting from "rad" toi "deg"
all custom UI components get notified and get the changed data
in the components should be a function with updates all Labels tagged with "LabelUnitAngle" from "rad" to "deg"
The non-generic solution is already working: comp.WheelAngleunitLabel.Text=comp.appSettings.units.angle.text;
comp.WheelAngleSpinner.Value = comp.ParamStore.WheelAngle*comp.appSettings.units.angle.factor;
I tried findall and findobj and tried using metaclasses but still no luck.I have a modularized App Designer app with several custom UI components. One UI component is a setting for units (e.g. km/h – mph or deg – radiant). These settings should be applied to all other custom UI components. To reduce the implementation work I wan’t a generic solution like:
User changed the setting from "rad" toi "deg"
all custom UI components get notified and get the changed data
in the components should be a function with updates all Labels tagged with "LabelUnitAngle" from "rad" to "deg"
The non-generic solution is already working: comp.WheelAngleunitLabel.Text=comp.appSettings.units.angle.text;
comp.WheelAngleSpinner.Value = comp.ParamStore.WheelAngle*comp.appSettings.units.angle.factor;
I tried findall and findobj and tried using metaclasses but still no luck. I have a modularized App Designer app with several custom UI components. One UI component is a setting for units (e.g. km/h – mph or deg – radiant). These settings should be applied to all other custom UI components. To reduce the implementation work I wan’t a generic solution like:
User changed the setting from "rad" toi "deg"
all custom UI components get notified and get the changed data
in the components should be a function with updates all Labels tagged with "LabelUnitAngle" from "rad" to "deg"
The non-generic solution is already working: comp.WheelAngleunitLabel.Text=comp.appSettings.units.angle.text;
comp.WheelAngleSpinner.Value = comp.ParamStore.WheelAngle*comp.appSettings.units.angle.factor;
I tried findall and findobj and tried using metaclasses but still no luck. customuicomponent, matlab.ui.componentcontainer.componentcontainer, tags MATLAB Answers — New Questions
how can i expose an AC electrical out of subsystem
hy guys, i am working on a project, peak shaving with BESS, i want to use Hybrid renewable energy system(wind and pv) i need a help on how to go about it, i am having problem in designing of the wind plant and how to export the three phase AC output out of the susbystem.hy guys, i am working on a project, peak shaving with BESS, i want to use Hybrid renewable energy system(wind and pv) i need a help on how to go about it, i am having problem in designing of the wind plant and how to export the three phase AC output out of the susbystem. hy guys, i am working on a project, peak shaving with BESS, i want to use Hybrid renewable energy system(wind and pv) i need a help on how to go about it, i am having problem in designing of the wind plant and how to export the three phase AC output out of the susbystem. simulink, model MATLAB Answers — New Questions
How can I move the find & replace window or get it to automatically close
The find window gets in the wayThe find window gets in the way The find window gets in the way find window MATLAB Answers — New Questions
How to truncate empty cells from a cell array?
I have a cell with some data that has empty cells in the array. Please disregard how ‘number_cell’ is made, it’s purely for example so readers have something to work with. In reality, I am receiving data that has empty rows and columns. I have no control over that.
number_cell = cell(4,4);
number_cell(1,1) = num2cell(1);
number_cell(1,2) = num2cell(2);
number_cell(1,4) = num2cell(3);
number_cell(2,1) = num2cell(7);
number_cell(2,2) = num2cell(8);
number_cell(2,4) = num2cell(9);
number_cell(4,1) = num2cell(14);
number_cell(4,2) = num2cell(15);
number_cell(4,4) = num2cell(17);
updated_cell = number_cell(~cellfun(‘isempty’,number_cell)) ; %I’ve tried playing with this to no avail.
The issue I have is that the 3rd column and 3rd row have empty cell values. What I need to do is truncate this 4×4 cell of the one row and column of empty cells so the output is a 3×3 matrix.
Here’s what I start with:
And here’s my desired output:
What do I need to change in my code?
Thanks for reading!I have a cell with some data that has empty cells in the array. Please disregard how ‘number_cell’ is made, it’s purely for example so readers have something to work with. In reality, I am receiving data that has empty rows and columns. I have no control over that.
number_cell = cell(4,4);
number_cell(1,1) = num2cell(1);
number_cell(1,2) = num2cell(2);
number_cell(1,4) = num2cell(3);
number_cell(2,1) = num2cell(7);
number_cell(2,2) = num2cell(8);
number_cell(2,4) = num2cell(9);
number_cell(4,1) = num2cell(14);
number_cell(4,2) = num2cell(15);
number_cell(4,4) = num2cell(17);
updated_cell = number_cell(~cellfun(‘isempty’,number_cell)) ; %I’ve tried playing with this to no avail.
The issue I have is that the 3rd column and 3rd row have empty cell values. What I need to do is truncate this 4×4 cell of the one row and column of empty cells so the output is a 3×3 matrix.
Here’s what I start with:
And here’s my desired output:
What do I need to change in my code?
Thanks for reading! I have a cell with some data that has empty cells in the array. Please disregard how ‘number_cell’ is made, it’s purely for example so readers have something to work with. In reality, I am receiving data that has empty rows and columns. I have no control over that.
number_cell = cell(4,4);
number_cell(1,1) = num2cell(1);
number_cell(1,2) = num2cell(2);
number_cell(1,4) = num2cell(3);
number_cell(2,1) = num2cell(7);
number_cell(2,2) = num2cell(8);
number_cell(2,4) = num2cell(9);
number_cell(4,1) = num2cell(14);
number_cell(4,2) = num2cell(15);
number_cell(4,4) = num2cell(17);
updated_cell = number_cell(~cellfun(‘isempty’,number_cell)) ; %I’ve tried playing with this to no avail.
The issue I have is that the 3rd column and 3rd row have empty cell values. What I need to do is truncate this 4×4 cell of the one row and column of empty cells so the output is a 3×3 matrix.
Here’s what I start with:
And here’s my desired output:
What do I need to change in my code?
Thanks for reading! cell, truncate, matlab MATLAB Answers — New Questions
How can we plot the same time history plot two times but the second time with a time delay of 2 sec?
How can we plot the same time history plot two times but the second time with a time delay of 2 sec?How can we plot the same time history plot two times but the second time with a time delay of 2 sec? How can we plot the same time history plot two times but the second time with a time delay of 2 sec? time history with a delay MATLAB Answers — New Questions
Is it possible to perform real-time low-pass filtering on the data received from the USRP X310 in Matlab
I do low-pass filtering on the received data from the X310, and find this step will slow down the processing speed.
Can implement filtering in the parallel way?
Can I do other demodulation steps parallelly in Matlab?
Thanks,
AlfredI do low-pass filtering on the received data from the X310, and find this step will slow down the processing speed.
Can implement filtering in the parallel way?
Can I do other demodulation steps parallelly in Matlab?
Thanks,
Alfred I do low-pass filtering on the received data from the X310, and find this step will slow down the processing speed.
Can implement filtering in the parallel way?
Can I do other demodulation steps parallelly in Matlab?
Thanks,
Alfred usrp, x310 MATLAB Answers — New Questions
Mixing subscripts with linear indices
Generally speaking, I have found that it has always been possible to mix subscript and linear array indexing with any n-dimensional array, as long as it is in the form,
A(subscript_1,subscript_2,…,subscript_n, linear_index).
For example, given,
A = reshape((1:24)*3, [4, 3, 2]);
all of the following are valid ways of indexing the final element in A,
A(4,3,2)
A(4,6)
A(24)
However, I haven’t been able to find documentation of this, except of course for the trivial case where n=0. Is it officially supported behavior?Generally speaking, I have found that it has always been possible to mix subscript and linear array indexing with any n-dimensional array, as long as it is in the form,
A(subscript_1,subscript_2,…,subscript_n, linear_index).
For example, given,
A = reshape((1:24)*3, [4, 3, 2]);
all of the following are valid ways of indexing the final element in A,
A(4,3,2)
A(4,6)
A(24)
However, I haven’t been able to find documentation of this, except of course for the trivial case where n=0. Is it officially supported behavior? Generally speaking, I have found that it has always been possible to mix subscript and linear array indexing with any n-dimensional array, as long as it is in the form,
A(subscript_1,subscript_2,…,subscript_n, linear_index).
For example, given,
A = reshape((1:24)*3, [4, 3, 2]);
all of the following are valid ways of indexing the final element in A,
A(4,3,2)
A(4,6)
A(24)
However, I haven’t been able to find documentation of this, except of course for the trivial case where n=0. Is it officially supported behavior? indexing, linear, subscripts, undocumented MATLAB Answers — New Questions
Do I have to own the toolboxes used in Matlab Academy courses?
I’m getting an error running the Control Systems Modeling Essentials due to not having Simscape. I didn’t see this listed as a requirement for the course before purchasing Matlab Academy. Is this intentional, or a technical issue with my account?I’m getting an error running the Control Systems Modeling Essentials due to not having Simscape. I didn’t see this listed as a requirement for the course before purchasing Matlab Academy. Is this intentional, or a technical issue with my account? I’m getting an error running the Control Systems Modeling Essentials due to not having Simscape. I didn’t see this listed as a requirement for the course before purchasing Matlab Academy. Is this intentional, or a technical issue with my account? training MATLAB Answers — New Questions
Comparing classification performance using Friedman Test
I am trying to compare the performance of three classifiers across four performance metrics using the Friedman test in MATLAB. Since MATLAB does not include a built-in Nemenyi post-hoc test, I used the "multcompare" function as suggested in related discussions. I obtained the following results. If I understand correctly, a high p-value indicates that there is no significant difference between the classifier performances. How should I interpret the values in c and m? Am I doing something wrong? Can Pearson’s r be used to compare the classifiers instead of Friedman and other post-hoc test? Thanks for the help.
PrfMat = [0.9352 0.9697 0.7475 0.9877;
0.9670 0.8713 0.8414 0.7052;
0.6944 0.6841 0.9851 0.9897];
[p,~,stats] = friedman(PrfMat, 1, ‘on’)
[c,m] = multcompare(stats, ‘CType’, ‘tukey-kramer’)
p = 0.8013
c = 1.0000 2.0000 -2.3747 0.3333 3.0413 0.9891
1.0000 3.0000 -2.0413 0.6667 3.3747 0.9216
1.0000 4.0000 -3.0413 -0.3333 2.3747 0.9891
2.0000 3.0000 -2.3747 0.3333 3.0413 0.9891
2.0000 4.0000 -3.3747 -0.6667 2.0413 0.9216
3.0000 4.0000 -3.7080 -1.0000 1.7080 0.7785
m = 2.6667 0.7454
2.3333 0.7454
2.0000 0.7454
3.0000 0.7454I am trying to compare the performance of three classifiers across four performance metrics using the Friedman test in MATLAB. Since MATLAB does not include a built-in Nemenyi post-hoc test, I used the "multcompare" function as suggested in related discussions. I obtained the following results. If I understand correctly, a high p-value indicates that there is no significant difference between the classifier performances. How should I interpret the values in c and m? Am I doing something wrong? Can Pearson’s r be used to compare the classifiers instead of Friedman and other post-hoc test? Thanks for the help.
PrfMat = [0.9352 0.9697 0.7475 0.9877;
0.9670 0.8713 0.8414 0.7052;
0.6944 0.6841 0.9851 0.9897];
[p,~,stats] = friedman(PrfMat, 1, ‘on’)
[c,m] = multcompare(stats, ‘CType’, ‘tukey-kramer’)
p = 0.8013
c = 1.0000 2.0000 -2.3747 0.3333 3.0413 0.9891
1.0000 3.0000 -2.0413 0.6667 3.3747 0.9216
1.0000 4.0000 -3.0413 -0.3333 2.3747 0.9891
2.0000 3.0000 -2.3747 0.3333 3.0413 0.9891
2.0000 4.0000 -3.3747 -0.6667 2.0413 0.9216
3.0000 4.0000 -3.7080 -1.0000 1.7080 0.7785
m = 2.6667 0.7454
2.3333 0.7454
2.0000 0.7454
3.0000 0.7454 I am trying to compare the performance of three classifiers across four performance metrics using the Friedman test in MATLAB. Since MATLAB does not include a built-in Nemenyi post-hoc test, I used the "multcompare" function as suggested in related discussions. I obtained the following results. If I understand correctly, a high p-value indicates that there is no significant difference between the classifier performances. How should I interpret the values in c and m? Am I doing something wrong? Can Pearson’s r be used to compare the classifiers instead of Friedman and other post-hoc test? Thanks for the help.
PrfMat = [0.9352 0.9697 0.7475 0.9877;
0.9670 0.8713 0.8414 0.7052;
0.6944 0.6841 0.9851 0.9897];
[p,~,stats] = friedman(PrfMat, 1, ‘on’)
[c,m] = multcompare(stats, ‘CType’, ‘tukey-kramer’)
p = 0.8013
c = 1.0000 2.0000 -2.3747 0.3333 3.0413 0.9891
1.0000 3.0000 -2.0413 0.6667 3.3747 0.9216
1.0000 4.0000 -3.0413 -0.3333 2.3747 0.9891
2.0000 3.0000 -2.3747 0.3333 3.0413 0.9891
2.0000 4.0000 -3.3747 -0.6667 2.0413 0.9216
3.0000 4.0000 -3.7080 -1.0000 1.7080 0.7785
m = 2.6667 0.7454
2.3333 0.7454
2.0000 0.7454
3.0000 0.7454 classification, friedman MATLAB Answers — New Questions
How do I import an audio file into simulink?
I’m currently attempting to test a digital filter in simulink, but I do not know how to import my test audio into Simulink.
I recorded a .wav file on my computer and I need a way to add it to my simulation. From my understanding, simulink cannot read a wav file directly, so I need a way to convert it into a format that can be worked with. I repeatedly attempted to use the Playback block to load it but it did not find the .wav file in the directory despite it being my current folder.
In the simulation, it will have noise added to it, then pass through my filter which hopefully removes the noise. I used the filter design app in MATLAB and exported the filter to Simulink, so while it is not necessary for me to do it all in Simulink, it would be convenient.
I also need to be able to convert the output data back into a .wav file so I can listen to it again. I’m not sure if it is relevant, but the filter has a 8kHz sample rate.I’m currently attempting to test a digital filter in simulink, but I do not know how to import my test audio into Simulink.
I recorded a .wav file on my computer and I need a way to add it to my simulation. From my understanding, simulink cannot read a wav file directly, so I need a way to convert it into a format that can be worked with. I repeatedly attempted to use the Playback block to load it but it did not find the .wav file in the directory despite it being my current folder.
In the simulation, it will have noise added to it, then pass through my filter which hopefully removes the noise. I used the filter design app in MATLAB and exported the filter to Simulink, so while it is not necessary for me to do it all in Simulink, it would be convenient.
I also need to be able to convert the output data back into a .wav file so I can listen to it again. I’m not sure if it is relevant, but the filter has a 8kHz sample rate. I’m currently attempting to test a digital filter in simulink, but I do not know how to import my test audio into Simulink.
I recorded a .wav file on my computer and I need a way to add it to my simulation. From my understanding, simulink cannot read a wav file directly, so I need a way to convert it into a format that can be worked with. I repeatedly attempted to use the Playback block to load it but it did not find the .wav file in the directory despite it being my current folder.
In the simulation, it will have noise added to it, then pass through my filter which hopefully removes the noise. I used the filter design app in MATLAB and exported the filter to Simulink, so while it is not necessary for me to do it all in Simulink, it would be convenient.
I also need to be able to convert the output data back into a .wav file so I can listen to it again. I’m not sure if it is relevant, but the filter has a 8kHz sample rate. audio processing, digital signal processing, digital filters, simulink MATLAB Answers — New Questions
When exporting a triangulation as an stl using stlwrite() the resulting stl is missing half of its faces.
I get an output file looking like the following picture when trying to export my triangulation object as an stl. the yellow represents valid faces and the red corresponds to missing faces. The section of code where I generate the face connectivity and convert to a triangulation object and subsequently an stl file.
Each "loadpath" (wiggly strand connecting one rectangle to the other) is defined in 2-d by a set of 2 1001 point curves, and in 3-d by a simple upwards translation of those curves. The matrix containing my points starts with 4 points defining the -z corners of the -x grip stock (rectangular section), followed by the +y and -y curves defining each of the loadpaths on the -z face of the object, then the 4 points defining the -z corners of the +x grip stock, the 4 points defining the +z corners of the -x grip stock, the upper loadpaths, and finally the 4 corners defining the +z corners of the +x grip stock.
% Generating tringular tiling of the loadpaths
f=zeros(3,2001*10*4);
for i=1:1000 % first loadpath
f(:,i)=[i,i+1,1001+i]; %y+ layer of triangles on bottom face
f(:,1000+i)=[i+1,1001+i,1002+i]; %y- layer of triangles on bottom face
f(:,20000+i)=[i,i+1,20028+i]; %z- layer of triangles on y+ face
f(:,21000+i)=[i+1,20028+i,20029+i]; %z+ layer of tringles on y+ face
f(:,40000+i)=[1001+i,1002+i,21029+i];
f(:,41000+i)=[1002+i,21029+i,21030+i];
f(:,60000+i)=[20028+i,20029+i,21029+i];
f(:,61000+i)=[20029+i,21029+i,21030+i];
end
for i=1:9 % loadpaths 2-10
f(:,((2000*i)+1):((2000*(i+1))))=f(:,1:2000)+2002*i;
f(:,((2000*i)+20000+1):(2000*(i+1)+20000))=f(:,20001:22000)+2002*i;
f(:,((2000*i)+40000+1):(2000*(i+1)+40000))=f(:,40001:42000)+2002*i;
f(:,((2000*i)+60000+1):(2000*(i+1)+60000))=f(:,60001:62000)+2002*i;
% faces between the loadpaths
f(:,i+80000)=[((i-.5)*2002)+1,((i)*2002)+1,(i-.5)*2002+20029];
f(:,i+80009)=[((i)*2002)+20029,((i)*2002)+1,(i-.5)*2002+20029];
f(:,i+80018)=f(:,i+80000)+1000;
f(:,i+80027)=f(:,i+80009)+1000;
end
f=f+4; % adjusting point indicies to reflect the first 4 points being used for grip stock
% generating grip stock and loadpath attachment points
f(:,80037)=[1,2,3]; % bottom face -x gs -x,-y triangle (third angle proj.)
f(:,80038)=[2,3,4]; % bottom face -x gs +x,+y triangle
f(:,80039)=[1,2,20029]; % left face -x gs -y,-z triangle
f(:,80040)=[1,3,20029]; % front face -x gs -x,-z triangle
f(:,80041)=[2,20030,20029]; % left face -x gs, +y,+z triangle
f(:,80042)=[2,4,20030]; % back face -x gs, -x,-z triangle
f(:,80043)=[4,20032,20030]; % back face -x gs, +x,+z triangle
f(:,80044)=[3,20031,20029]; % front face -x gs, +x,+z triangle
f(:,80045:80046)=[f(:,80037),f(:,80038)]+20028; % top face +x gs, both triangles
f(:,80047:80056)=f(:,80037:80046)+20024; % +x gs, all triangles
% attaching grip stock to first and last loadpaths.
f(:,80057)=[4,5,20032];
f(:,80058)=[5,20032,20033];
f(:,80059)=[20028,1005,21033];
f(:,80060)=[20028,21033,40056];
f(:,80061)=[3,19024,39052];
f(:,80062)=[3,20031,39052];
f(:,80063)=[20024,20027,40055];
f(:,80064)=[40055,40051,20024];
%% converting to triangulation object and stl
tr=triangulation(f’,db’);
%trisurf(tr)
axis ‘equal’
stlwrite(tr, ‘stl_test.stl’)
%patch(‘Faces’,f(:,:)’,’Vertices’,db’,’facecol’,[1,0,0],’edgecol’,’k’);I get an output file looking like the following picture when trying to export my triangulation object as an stl. the yellow represents valid faces and the red corresponds to missing faces. The section of code where I generate the face connectivity and convert to a triangulation object and subsequently an stl file.
Each "loadpath" (wiggly strand connecting one rectangle to the other) is defined in 2-d by a set of 2 1001 point curves, and in 3-d by a simple upwards translation of those curves. The matrix containing my points starts with 4 points defining the -z corners of the -x grip stock (rectangular section), followed by the +y and -y curves defining each of the loadpaths on the -z face of the object, then the 4 points defining the -z corners of the +x grip stock, the 4 points defining the +z corners of the -x grip stock, the upper loadpaths, and finally the 4 corners defining the +z corners of the +x grip stock.
% Generating tringular tiling of the loadpaths
f=zeros(3,2001*10*4);
for i=1:1000 % first loadpath
f(:,i)=[i,i+1,1001+i]; %y+ layer of triangles on bottom face
f(:,1000+i)=[i+1,1001+i,1002+i]; %y- layer of triangles on bottom face
f(:,20000+i)=[i,i+1,20028+i]; %z- layer of triangles on y+ face
f(:,21000+i)=[i+1,20028+i,20029+i]; %z+ layer of tringles on y+ face
f(:,40000+i)=[1001+i,1002+i,21029+i];
f(:,41000+i)=[1002+i,21029+i,21030+i];
f(:,60000+i)=[20028+i,20029+i,21029+i];
f(:,61000+i)=[20029+i,21029+i,21030+i];
end
for i=1:9 % loadpaths 2-10
f(:,((2000*i)+1):((2000*(i+1))))=f(:,1:2000)+2002*i;
f(:,((2000*i)+20000+1):(2000*(i+1)+20000))=f(:,20001:22000)+2002*i;
f(:,((2000*i)+40000+1):(2000*(i+1)+40000))=f(:,40001:42000)+2002*i;
f(:,((2000*i)+60000+1):(2000*(i+1)+60000))=f(:,60001:62000)+2002*i;
% faces between the loadpaths
f(:,i+80000)=[((i-.5)*2002)+1,((i)*2002)+1,(i-.5)*2002+20029];
f(:,i+80009)=[((i)*2002)+20029,((i)*2002)+1,(i-.5)*2002+20029];
f(:,i+80018)=f(:,i+80000)+1000;
f(:,i+80027)=f(:,i+80009)+1000;
end
f=f+4; % adjusting point indicies to reflect the first 4 points being used for grip stock
% generating grip stock and loadpath attachment points
f(:,80037)=[1,2,3]; % bottom face -x gs -x,-y triangle (third angle proj.)
f(:,80038)=[2,3,4]; % bottom face -x gs +x,+y triangle
f(:,80039)=[1,2,20029]; % left face -x gs -y,-z triangle
f(:,80040)=[1,3,20029]; % front face -x gs -x,-z triangle
f(:,80041)=[2,20030,20029]; % left face -x gs, +y,+z triangle
f(:,80042)=[2,4,20030]; % back face -x gs, -x,-z triangle
f(:,80043)=[4,20032,20030]; % back face -x gs, +x,+z triangle
f(:,80044)=[3,20031,20029]; % front face -x gs, +x,+z triangle
f(:,80045:80046)=[f(:,80037),f(:,80038)]+20028; % top face +x gs, both triangles
f(:,80047:80056)=f(:,80037:80046)+20024; % +x gs, all triangles
% attaching grip stock to first and last loadpaths.
f(:,80057)=[4,5,20032];
f(:,80058)=[5,20032,20033];
f(:,80059)=[20028,1005,21033];
f(:,80060)=[20028,21033,40056];
f(:,80061)=[3,19024,39052];
f(:,80062)=[3,20031,39052];
f(:,80063)=[20024,20027,40055];
f(:,80064)=[40055,40051,20024];
%% converting to triangulation object and stl
tr=triangulation(f’,db’);
%trisurf(tr)
axis ‘equal’
stlwrite(tr, ‘stl_test.stl’)
%patch(‘Faces’,f(:,:)’,’Vertices’,db’,’facecol’,[1,0,0],’edgecol’,’k’); I get an output file looking like the following picture when trying to export my triangulation object as an stl. the yellow represents valid faces and the red corresponds to missing faces. The section of code where I generate the face connectivity and convert to a triangulation object and subsequently an stl file.
Each "loadpath" (wiggly strand connecting one rectangle to the other) is defined in 2-d by a set of 2 1001 point curves, and in 3-d by a simple upwards translation of those curves. The matrix containing my points starts with 4 points defining the -z corners of the -x grip stock (rectangular section), followed by the +y and -y curves defining each of the loadpaths on the -z face of the object, then the 4 points defining the -z corners of the +x grip stock, the 4 points defining the +z corners of the -x grip stock, the upper loadpaths, and finally the 4 corners defining the +z corners of the +x grip stock.
% Generating tringular tiling of the loadpaths
f=zeros(3,2001*10*4);
for i=1:1000 % first loadpath
f(:,i)=[i,i+1,1001+i]; %y+ layer of triangles on bottom face
f(:,1000+i)=[i+1,1001+i,1002+i]; %y- layer of triangles on bottom face
f(:,20000+i)=[i,i+1,20028+i]; %z- layer of triangles on y+ face
f(:,21000+i)=[i+1,20028+i,20029+i]; %z+ layer of tringles on y+ face
f(:,40000+i)=[1001+i,1002+i,21029+i];
f(:,41000+i)=[1002+i,21029+i,21030+i];
f(:,60000+i)=[20028+i,20029+i,21029+i];
f(:,61000+i)=[20029+i,21029+i,21030+i];
end
for i=1:9 % loadpaths 2-10
f(:,((2000*i)+1):((2000*(i+1))))=f(:,1:2000)+2002*i;
f(:,((2000*i)+20000+1):(2000*(i+1)+20000))=f(:,20001:22000)+2002*i;
f(:,((2000*i)+40000+1):(2000*(i+1)+40000))=f(:,40001:42000)+2002*i;
f(:,((2000*i)+60000+1):(2000*(i+1)+60000))=f(:,60001:62000)+2002*i;
% faces between the loadpaths
f(:,i+80000)=[((i-.5)*2002)+1,((i)*2002)+1,(i-.5)*2002+20029];
f(:,i+80009)=[((i)*2002)+20029,((i)*2002)+1,(i-.5)*2002+20029];
f(:,i+80018)=f(:,i+80000)+1000;
f(:,i+80027)=f(:,i+80009)+1000;
end
f=f+4; % adjusting point indicies to reflect the first 4 points being used for grip stock
% generating grip stock and loadpath attachment points
f(:,80037)=[1,2,3]; % bottom face -x gs -x,-y triangle (third angle proj.)
f(:,80038)=[2,3,4]; % bottom face -x gs +x,+y triangle
f(:,80039)=[1,2,20029]; % left face -x gs -y,-z triangle
f(:,80040)=[1,3,20029]; % front face -x gs -x,-z triangle
f(:,80041)=[2,20030,20029]; % left face -x gs, +y,+z triangle
f(:,80042)=[2,4,20030]; % back face -x gs, -x,-z triangle
f(:,80043)=[4,20032,20030]; % back face -x gs, +x,+z triangle
f(:,80044)=[3,20031,20029]; % front face -x gs, +x,+z triangle
f(:,80045:80046)=[f(:,80037),f(:,80038)]+20028; % top face +x gs, both triangles
f(:,80047:80056)=f(:,80037:80046)+20024; % +x gs, all triangles
% attaching grip stock to first and last loadpaths.
f(:,80057)=[4,5,20032];
f(:,80058)=[5,20032,20033];
f(:,80059)=[20028,1005,21033];
f(:,80060)=[20028,21033,40056];
f(:,80061)=[3,19024,39052];
f(:,80062)=[3,20031,39052];
f(:,80063)=[20024,20027,40055];
f(:,80064)=[40055,40051,20024];
%% converting to triangulation object and stl
tr=triangulation(f’,db’);
%trisurf(tr)
axis ‘equal’
stlwrite(tr, ‘stl_test.stl’)
%patch(‘Faces’,f(:,:)’,’Vertices’,db’,’facecol’,[1,0,0],’edgecol’,’k’); stl, triangulation MATLAB Answers — New Questions
Why my push-pull is giving 0 V?
Hi,
I am designing a push-pull converter. I copied the control from this example after having tried the control that was in another example made by a user. However, that one wasn’t giving a correct closed-loop answer as it was giving an input of 0 to the gates while the output voltage was stable. So someone suggested me to see the example from the first link and now that control is making the output voltage to be 0 V. The control is as shown below:
As you can see, my reference voltage is 350 V and the switching frequency is 50000 Hz. My input voltage is 137.14 V because it will come from another stage that will give at most an output voltage of 137.14 V. It doesn’t even work with this control in open-loop when I connect a constant value of 0.159 to the gain of 0.5 and the PI and comparison of the left is not connected.
I know that in a push-pull the transistors conduct the same time but not simultaneously a maximum of 50% each, but could someone explain me how this control ensures this and why is not working for me?
I see that the left transistor is not switching by looking at the waveforms:
The gate_L waveform is the top right one and the top left is for the output voltage.
Also, these are the values I have in the multi-winding transformer (no taps) as I am using the black blocks and not the blue as in the example:
The push-pull looks like this:
Thanks.
CarlosHi,
I am designing a push-pull converter. I copied the control from this example after having tried the control that was in another example made by a user. However, that one wasn’t giving a correct closed-loop answer as it was giving an input of 0 to the gates while the output voltage was stable. So someone suggested me to see the example from the first link and now that control is making the output voltage to be 0 V. The control is as shown below:
As you can see, my reference voltage is 350 V and the switching frequency is 50000 Hz. My input voltage is 137.14 V because it will come from another stage that will give at most an output voltage of 137.14 V. It doesn’t even work with this control in open-loop when I connect a constant value of 0.159 to the gain of 0.5 and the PI and comparison of the left is not connected.
I know that in a push-pull the transistors conduct the same time but not simultaneously a maximum of 50% each, but could someone explain me how this control ensures this and why is not working for me?
I see that the left transistor is not switching by looking at the waveforms:
The gate_L waveform is the top right one and the top left is for the output voltage.
Also, these are the values I have in the multi-winding transformer (no taps) as I am using the black blocks and not the blue as in the example:
The push-pull looks like this:
Thanks.
Carlos Hi,
I am designing a push-pull converter. I copied the control from this example after having tried the control that was in another example made by a user. However, that one wasn’t giving a correct closed-loop answer as it was giving an input of 0 to the gates while the output voltage was stable. So someone suggested me to see the example from the first link and now that control is making the output voltage to be 0 V. The control is as shown below:
As you can see, my reference voltage is 350 V and the switching frequency is 50000 Hz. My input voltage is 137.14 V because it will come from another stage that will give at most an output voltage of 137.14 V. It doesn’t even work with this control in open-loop when I connect a constant value of 0.159 to the gain of 0.5 and the PI and comparison of the left is not connected.
I know that in a push-pull the transistors conduct the same time but not simultaneously a maximum of 50% each, but could someone explain me how this control ensures this and why is not working for me?
I see that the left transistor is not switching by looking at the waveforms:
The gate_L waveform is the top right one and the top left is for the output voltage.
Also, these are the values I have in the multi-winding transformer (no taps) as I am using the black blocks and not the blue as in the example:
The push-pull looks like this:
Thanks.
Carlos push-pull converter, power_electronics_control, power_conversion_control, simulink, pi controller MATLAB Answers — New Questions
MATLAB 2025: Why can’t I close a figure using Mac keyboard shortcuts?
I just downloaded MATLAB 2025a and all is working well so far except a strange quirk: There is no easy way to close a figure window using standard Mac keyboard shortcuts.
In previous versions, I can close a figure window by pressing the standard Cmd+w. This keyboard shortcut is used across Mac to close windows, browser tabs, documents, etc. Its a very generic keystroke and not in the list of MATLAB-specific keyboard shortcuts.
It’s very bizarre because literally all other generic Mac keyboard shortcuts still work fine in MATLAB 2025, even when applied to figure windows. For example, I can minimize the figure window using Cmd+m. I can also toggle between figure windows using Cmd+`. So other Mac keyboard shortcuts apply to figures fine.
Adding to the mystery, I can still use the exact same Cmd+w keyboard shortcut to close an m file that is open in the editor. So the Cmd+w shortcut is recognized within MATLAB 2025. But does not work to close a figure.
Maybe its just me being nitpicky, but its really annoying because I use a lot of keyboard shortcuts in my work. Currently the only alternative is to reach all the way to my mouse and move the mouse to the x and click to close the figure, or I have to type "close" in the command window. Each of these takes at least 10x longer than hitting Cmd+w to quickly close a single figure.
Anyone else experiecing this? Any fix?I just downloaded MATLAB 2025a and all is working well so far except a strange quirk: There is no easy way to close a figure window using standard Mac keyboard shortcuts.
In previous versions, I can close a figure window by pressing the standard Cmd+w. This keyboard shortcut is used across Mac to close windows, browser tabs, documents, etc. Its a very generic keystroke and not in the list of MATLAB-specific keyboard shortcuts.
It’s very bizarre because literally all other generic Mac keyboard shortcuts still work fine in MATLAB 2025, even when applied to figure windows. For example, I can minimize the figure window using Cmd+m. I can also toggle between figure windows using Cmd+`. So other Mac keyboard shortcuts apply to figures fine.
Adding to the mystery, I can still use the exact same Cmd+w keyboard shortcut to close an m file that is open in the editor. So the Cmd+w shortcut is recognized within MATLAB 2025. But does not work to close a figure.
Maybe its just me being nitpicky, but its really annoying because I use a lot of keyboard shortcuts in my work. Currently the only alternative is to reach all the way to my mouse and move the mouse to the x and click to close the figure, or I have to type "close" in the command window. Each of these takes at least 10x longer than hitting Cmd+w to quickly close a single figure.
Anyone else experiecing this? Any fix? I just downloaded MATLAB 2025a and all is working well so far except a strange quirk: There is no easy way to close a figure window using standard Mac keyboard shortcuts.
In previous versions, I can close a figure window by pressing the standard Cmd+w. This keyboard shortcut is used across Mac to close windows, browser tabs, documents, etc. Its a very generic keystroke and not in the list of MATLAB-specific keyboard shortcuts.
It’s very bizarre because literally all other generic Mac keyboard shortcuts still work fine in MATLAB 2025, even when applied to figure windows. For example, I can minimize the figure window using Cmd+m. I can also toggle between figure windows using Cmd+`. So other Mac keyboard shortcuts apply to figures fine.
Adding to the mystery, I can still use the exact same Cmd+w keyboard shortcut to close an m file that is open in the editor. So the Cmd+w shortcut is recognized within MATLAB 2025. But does not work to close a figure.
Maybe its just me being nitpicky, but its really annoying because I use a lot of keyboard shortcuts in my work. Currently the only alternative is to reach all the way to my mouse and move the mouse to the x and click to close the figure, or I have to type "close" in the command window. Each of these takes at least 10x longer than hitting Cmd+w to quickly close a single figure.
Anyone else experiecing this? Any fix? figure, mac, matlab MATLAB Answers — New Questions
Example Does Not Work
I try to run the example. The second line of code workerToClient = parallel.pool.PollableDataQueue(Destination="any") gives me this error:
Error using parallel.pool.PollableDataQueue (line 28)
Too many input arguments.
I remove the Destination = "any" argument and that seems to get things working. But then I get to the for-loop in the example:
for idx = 1:5
send(clientToWorker, [idx rand]);
status = poll(workerToClient, inf)
end
and the computer locks up with no output. I force-quite (CTRL-C) and type
future.State
The result is ‘finished’. It seems the process stopped and I never sent the stop message. Seems nothing I can do will keep the process running.I try to run the example. The second line of code workerToClient = parallel.pool.PollableDataQueue(Destination="any") gives me this error:
Error using parallel.pool.PollableDataQueue (line 28)
Too many input arguments.
I remove the Destination = "any" argument and that seems to get things working. But then I get to the for-loop in the example:
for idx = 1:5
send(clientToWorker, [idx rand]);
status = poll(workerToClient, inf)
end
and the computer locks up with no output. I force-quite (CTRL-C) and type
future.State
The result is ‘finished’. It seems the process stopped and I never sent the stop message. Seems nothing I can do will keep the process running. I try to run the example. The second line of code workerToClient = parallel.pool.PollableDataQueue(Destination="any") gives me this error:
Error using parallel.pool.PollableDataQueue (line 28)
Too many input arguments.
I remove the Destination = "any" argument and that seems to get things working. But then I get to the for-loop in the example:
for idx = 1:5
send(clientToWorker, [idx rand]);
status = poll(workerToClient, inf)
end
and the computer locks up with no output. I force-quite (CTRL-C) and type
future.State
The result is ‘finished’. It seems the process stopped and I never sent the stop message. Seems nothing I can do will keep the process running. parallel computing, pollabledataqueue MATLAB Answers — New Questions
Error when I want to open files
When I want to open a file from my computer (I want to open a matlab file) I get the following error:
Exception in thread "AWT-EventQueue-0": com.mathworks.util.event.EventListenerInvocationException: Error firing event:
caused by:
java.util.MissingResourceException: Can’t find bundle for base name SLDD:sldd, locale sr_RS
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:899)
at com.mathworks.fl.i18n.XMLMessageSystem.getBundle(Unknown Source)
at com.mathworks.fl.i18n.XMLMessageSystem.getBundle(Unknown Source)
at com.mathworks.toolbox.simulink.datadictionary.desktopintegration.SLDDFileExtensionFilterContributor.getMessageCatalogString(SLDDFileExtensionFilterContributor.java:46)
at com.mathworks.toolbox.simulink.datadictionary.desktopintegration.SLDDFileExtensionFilterContributor.getDialogFilters(SLDDFileExtensionFilterContributor.java:31)
at com.mathworks.mwswing.FileExtensionFilterUtils.sortFileExtensionFilters(FileExtensionFilterUtils.java:109)
at com.mathworks.mwswing.FileExtensionFilterUtils.getFileExtensionFilters(FileExtensionFilterUtils.java:96)
at com.mathworks.mde.desk.MLDesktop.showOpenDialog(MLDesktop.java:2999)
at com.mathworks.mde.desk.MLDesktop$OpenAction.actionPerformed(MLDesktop.java:2994)
at com.mathworks.mwswing.ChildAction.actionPerformed(ChildAction.java:214)
at com.mathworks.toolstrip.factory.TSFactory$ListListenerBridge.listItemSelected(TSFactory.java:1555)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:72)
at com.sun.proxy.$Proxy11.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:521)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: fl:i18n:MwLcInvLcName
at com.mathworks.fl.i18n.XMLMessageSystemJNI.nativeLoadMessageCatalog(Native Method)
at com.mathworks.fl.i18n.XMLResourceBundleControl$XMLResourceBundle.<init>(Unknown Source)
at com.mathworks.fl.i18n.XMLResourceBundleControl.newBundle(Unknown Source)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1518)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1482)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1370)
… 50 more
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:85)
at com.sun.proxy.$Proxy11.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:521)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)When I want to open a file from my computer (I want to open a matlab file) I get the following error:
Exception in thread "AWT-EventQueue-0": com.mathworks.util.event.EventListenerInvocationException: Error firing event:
caused by:
java.util.MissingResourceException: Can’t find bundle for base name SLDD:sldd, locale sr_RS
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:899)
at com.mathworks.fl.i18n.XMLMessageSystem.getBundle(Unknown Source)
at com.mathworks.fl.i18n.XMLMessageSystem.getBundle(Unknown Source)
at com.mathworks.toolbox.simulink.datadictionary.desktopintegration.SLDDFileExtensionFilterContributor.getMessageCatalogString(SLDDFileExtensionFilterContributor.java:46)
at com.mathworks.toolbox.simulink.datadictionary.desktopintegration.SLDDFileExtensionFilterContributor.getDialogFilters(SLDDFileExtensionFilterContributor.java:31)
at com.mathworks.mwswing.FileExtensionFilterUtils.sortFileExtensionFilters(FileExtensionFilterUtils.java:109)
at com.mathworks.mwswing.FileExtensionFilterUtils.getFileExtensionFilters(FileExtensionFilterUtils.java:96)
at com.mathworks.mde.desk.MLDesktop.showOpenDialog(MLDesktop.java:2999)
at com.mathworks.mde.desk.MLDesktop$OpenAction.actionPerformed(MLDesktop.java:2994)
at com.mathworks.mwswing.ChildAction.actionPerformed(ChildAction.java:214)
at com.mathworks.toolstrip.factory.TSFactory$ListListenerBridge.listItemSelected(TSFactory.java:1555)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:72)
at com.sun.proxy.$Proxy11.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:521)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: fl:i18n:MwLcInvLcName
at com.mathworks.fl.i18n.XMLMessageSystemJNI.nativeLoadMessageCatalog(Native Method)
at com.mathworks.fl.i18n.XMLResourceBundleControl$XMLResourceBundle.<init>(Unknown Source)
at com.mathworks.fl.i18n.XMLResourceBundleControl.newBundle(Unknown Source)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1518)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1482)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1370)
… 50 more
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:85)
at com.sun.proxy.$Proxy11.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:521)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) When I want to open a file from my computer (I want to open a matlab file) I get the following error:
Exception in thread "AWT-EventQueue-0": com.mathworks.util.event.EventListenerInvocationException: Error firing event:
caused by:
java.util.MissingResourceException: Can’t find bundle for base name SLDD:sldd, locale sr_RS
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:899)
at com.mathworks.fl.i18n.XMLMessageSystem.getBundle(Unknown Source)
at com.mathworks.fl.i18n.XMLMessageSystem.getBundle(Unknown Source)
at com.mathworks.toolbox.simulink.datadictionary.desktopintegration.SLDDFileExtensionFilterContributor.getMessageCatalogString(SLDDFileExtensionFilterContributor.java:46)
at com.mathworks.toolbox.simulink.datadictionary.desktopintegration.SLDDFileExtensionFilterContributor.getDialogFilters(SLDDFileExtensionFilterContributor.java:31)
at com.mathworks.mwswing.FileExtensionFilterUtils.sortFileExtensionFilters(FileExtensionFilterUtils.java:109)
at com.mathworks.mwswing.FileExtensionFilterUtils.getFileExtensionFilters(FileExtensionFilterUtils.java:96)
at com.mathworks.mde.desk.MLDesktop.showOpenDialog(MLDesktop.java:2999)
at com.mathworks.mde.desk.MLDesktop$OpenAction.actionPerformed(MLDesktop.java:2994)
at com.mathworks.mwswing.ChildAction.actionPerformed(ChildAction.java:214)
at com.mathworks.toolstrip.factory.TSFactory$ListListenerBridge.listItemSelected(TSFactory.java:1555)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:72)
at com.sun.proxy.$Proxy11.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:521)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: fl:i18n:MwLcInvLcName
at com.mathworks.fl.i18n.XMLMessageSystemJNI.nativeLoadMessageCatalog(Native Method)
at com.mathworks.fl.i18n.XMLResourceBundleControl$XMLResourceBundle.<init>(Unknown Source)
at com.mathworks.fl.i18n.XMLResourceBundleControl.newBundle(Unknown Source)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1518)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1482)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1370)
… 50 more
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:85)
at com.sun.proxy.$Proxy11.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:521)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) opening files, matlab, java, error MATLAB Answers — New Questions
Error using scatteredInterpolant Sample values must be a double array.
Dear all,
I use griddata to interpolate one 2D data. The codes worked quite well half a year. But since today, it always showed an error "Error using scatteredInterpolant. Sample values must be a double array."
Can anyone do me a favor. Thanks a lot.Dear all,
I use griddata to interpolate one 2D data. The codes worked quite well half a year. But since today, it always showed an error "Error using scatteredInterpolant. Sample values must be a double array."
Can anyone do me a favor. Thanks a lot. Dear all,
I use griddata to interpolate one 2D data. The codes worked quite well half a year. But since today, it always showed an error "Error using scatteredInterpolant. Sample values must be a double array."
Can anyone do me a favor. Thanks a lot. griddata, 2d data MATLAB Answers — New Questions
Sharpening a 2D histogram and finding peaks
Can you help me?
I have a bunch of 2D histograms that I’d like to sharpen so that I can identify some features. Here is an example image:
Each vertical line in the image is a scan (row) in my data and I really want to operate on a per-row basis. The sharpening needs to be primarily in the vertical (value) direction.
I’m trying to identify the center (i.e., median, mode) of the upper and the lower peak for each scan. Any intermediate peaks (for example in scans 3-10) are of lesser interest. Finding the center of the the lower peak is the primary challenge.
I have attached a data file containing the data I used to generate the plot. Here is the plotting code:
function PlotHist(plotData, plotTitle)
figure;
surf(plotData); shading("flat");
xlim([0, 4096]); xticks(0 : 512 : 4096); xlabel("Laser Value");
ylim([0, size(plotData, 1)]); ylabel("Scan");
cb = colorbar; cb.Label.String = ‘# points’;
view([90, -90])
title(plotTitle, Interpreter = ‘none’);
end
I’ve reviewed and tried a number of the Matlab answers on deblurring and sharpening, but I’m struggling to focus my results in the vertical direction.Can you help me?
I have a bunch of 2D histograms that I’d like to sharpen so that I can identify some features. Here is an example image:
Each vertical line in the image is a scan (row) in my data and I really want to operate on a per-row basis. The sharpening needs to be primarily in the vertical (value) direction.
I’m trying to identify the center (i.e., median, mode) of the upper and the lower peak for each scan. Any intermediate peaks (for example in scans 3-10) are of lesser interest. Finding the center of the the lower peak is the primary challenge.
I have attached a data file containing the data I used to generate the plot. Here is the plotting code:
function PlotHist(plotData, plotTitle)
figure;
surf(plotData); shading("flat");
xlim([0, 4096]); xticks(0 : 512 : 4096); xlabel("Laser Value");
ylim([0, size(plotData, 1)]); ylabel("Scan");
cb = colorbar; cb.Label.String = ‘# points’;
view([90, -90])
title(plotTitle, Interpreter = ‘none’);
end
I’ve reviewed and tried a number of the Matlab answers on deblurring and sharpening, but I’m struggling to focus my results in the vertical direction. Can you help me?
I have a bunch of 2D histograms that I’d like to sharpen so that I can identify some features. Here is an example image:
Each vertical line in the image is a scan (row) in my data and I really want to operate on a per-row basis. The sharpening needs to be primarily in the vertical (value) direction.
I’m trying to identify the center (i.e., median, mode) of the upper and the lower peak for each scan. Any intermediate peaks (for example in scans 3-10) are of lesser interest. Finding the center of the the lower peak is the primary challenge.
I have attached a data file containing the data I used to generate the plot. Here is the plotting code:
function PlotHist(plotData, plotTitle)
figure;
surf(plotData); shading("flat");
xlim([0, 4096]); xticks(0 : 512 : 4096); xlabel("Laser Value");
ylim([0, size(plotData, 1)]); ylabel("Scan");
cb = colorbar; cb.Label.String = ‘# points’;
view([90, -90])
title(plotTitle, Interpreter = ‘none’);
end
I’ve reviewed and tried a number of the Matlab answers on deblurring and sharpening, but I’m struggling to focus my results in the vertical direction. 2d histogram, sharpening, peak-finding MATLAB Answers — New Questions
Checking the Effectiveness of a Transport Rule to Block Spammy Email
No Point in Having Transport Rules if They’re Not Doing the Job
A few weeks ago, I wrote about using the Microsoft Graph to extract a list of spammy domains from messages in the Junk Email folder in user mailboxes. The list is then used as input to a transport rule so that any email arriving from spammy domains end up in the quarantine instead of user mailboxes. Apart from bothering users with system messages notifying them about quarantined email (Figure 1), the technique worked nicely. A scheduled Azure Automation runbook picks up new spammy domains as they appear and add them to the transport rule.

In fact, the transport rule worked so well that I decided to stop bothering users with quarantine notifications and updated the transport rule to delete messages from the spammy domains without saying anything to the sender. Now the only quarantine notifications that appear in user inboxes are for messages not received from the spammy domains.
Check and Verify
Then I had a nasty feeling that perhaps the transport rule was working too well and that some messages might have been dropped in error. My gut says that everything’s OK, but some verification would improve my confidence. One way of checking is to search user mailboxes to see if any messages from the banned domains have arrived since the rule started to operate, but that seems a little intrusive. Another method is needed.
To seek confirmation, I ran the Get-MailDetailTransportRuleReport cmdlet to fetch data about the outcomes of mail transport rules for the last 10 days (like message trace logs, 10 days is the maximum Exchange Online keeps this data available for immediate interrogation).
The transport rule report can filter on actions taken by rules. The set of supported actions can be found by running the Get-MailFilterListReport cmdlet:
Get-MailFilterListReport -SelectionTarget Actions SelectionTarget Display Value --------------- ------- ----- Actions AddBccRecipient AddBccRecipient Actions AddCcRecipient AddCcRecipient Actions AddManagerAsRecipient AddManagerAsRecipient Actions AddToRecipient AddToRecipient Actions Allow Allow Actions AllowRedirect AllowRedirect Actions ApplyClassification ApplyClassification Actions ApplyHtmlDisclaimer ApplyHtmlDisclaimer Actions BlockAccess BlockAccess etc.
Summarizing the Result of the Transport Rule Block
The transport rule deletes spammy messages quietly, so the right action to use is “DeleteMessage.” Here’s the command I used to find and summarize the events:
[array]$Data = Get-MailDetailTransportRuleReport -Direction inbound -Action DeleteMessage $Data | Group-Object 'TransportRule' -NoElement | Format-Table Name, Count Name Count ---- ----- Block email to administrators from outside the organization 65 Quarantine Traffic from Junk Email Domains 80
The information contained in a transport rule report event looks like this:
Date : 02/11/2025 10:42:06 Message ID : <89a2ec2634a1de9811917cb90a02fe3c@9pz.org> Message Trace ID : e07c2b05-ea8a-429d-e933-08de19fc77b1 Domain : office365itpros.com Subject : Re: We make packing bags in China Message Size : 31720 Direction : Inbound Sender Address : 1232@9pz.org Recipient Address : james.a.abrahams@office365itpros.com Event Type : TransportRuleActionHits Action : DeleteMessage Transport Rule : Quarantine Traffic from Junk Email Domains
We can extract and summarize the set of events for the block from spam domain transport rule to discover who would have received the spam had the block not existed:
$TransportRule = 'Quarantine Traffic from Junk Email Domains'
[array]$MData = $Data | Where-Object {$_.'TransportRule' -eq $TransportRule}
$MData | Group-Object -NoElement RecipientAddress | Sort-Object Count -Descending | Format-Table Name, Count
Name Count
---- -----
tony.redmond@office365itpros.com 27
james.a.abrahams@office365itpros.com 7
andy.ruth@office365itpros.com 5
lotte.vetler@office365itpros.com 5
sean.landy@office365itpros.com 5
brian.weakliam@office365itpros.com 4
jeff.atkinson@office365itpros.com 4
office365.book.comments@office365itpros.com 4
terry.hegarty@office365itpros.com 4
contact@office365itpros.com 3
o365itprosrenewals@office365itpros.com 2
marty.king@office365itpros.com 1
office365book@office365itpros.com 1
Most of these addresses are for dummy accounts or shared mailboxes used for testing. Spammers learn of the addresses by harvesting information from web articles, but they gain nothing by sending messages to the accounts. However, I don’t like cleaning out the spam before taking screenshots for articles, so I’m delighted to see that the transport rule is doing its job.
Finding how many messages came from specific spammy domains takes a little extra effort. Here’s some code to report the number of messages from each domain processed by the transport rule:
[array]$SpammyDomains = (Get-TransportRule -Identity $TransportRule).SenderDomainIs
ForEach ($Domain in $SpammyDomains) {
$CheckDomain = "*"+$Domain+"*"
[array]$SpamRecords = $MData | Where-Object {$_.SenderAddress -like $CheckDomain}
If ($SpamRecords.Count -gt 0) {
Write-Host ("Domain {0} sent {1} spammy messages" -f $Domain, $SpamRecords.Count)
}
}
Domain 9pz.org sent 7 spammy messages
Domain conarh02.com sent 6 spammy messages
Domain conarh03.com.mx sent 25 spammy messages
Domain conarh07.com sent 6 spammy messages
Domain spamareus.com sent 11 spammy messages
Domain fgwexvb.asia sent 4 spammy messages
Domain forkcontact.com sent 1 spammy messages
Domain moonpig.com sent 4 spammy messages
Domain annoyingcompany.co.uk sent 3 spammy messages
Domain tradetpt12.com sent 5 spammy messages
Domain tradetpxs10.com sent 4 spammy messages
Domain getportant.com sent 4 spammy messages
Some Manipulation Required
The lesson here is that a method exists to validate the effectiveness of transport rules. Extracting the desired information from the transport rule report might take some manipulation with PowerShell, but it’s certainly a way to check how well your rules work.
Learn about managing Exchange Online and the rest of the Microsoft 365 ecosystem by subscribing to the Office 365 for IT Pros eBook. Use our experience to understand what’s important and how best to protect your tenant.
Finite elements model using STABIL
We are working on a finite elements model using the plug-in STABIL. We get no errors but our displacements are all giving NaN as solution. Can someone explain the meaning of these NaNs? Our K and P matrix look logical so we are out of options…
%initializing
clc
close all
clear all
% units kN,m
unzip(‘stabil-3.1.zip’);
% CALCULATING THE NODES
%STEP N1: the deck
% Nodes=[NodID X Y Z]
Nodes= [1 21 0 4;
2 21+5.25*1 0 4;
3 21+5.25*2 0 4;
4 21+5.25*3 0 4;
5 21+5.25*4 0 4;
6 21+5.25*5 0 4;
7 21+5.25*6 0 4;
8 21+5.25*7 0 4;
9 21+5.25*8 0 4];
Nodes = reprow(Nodes, 1:9, 1, [9 0 4.2 0]);
Nodes = reprow(Nodes, 10:18, 1, [9 0 4.5 0]);
Nodes = reprow(Nodes, 19:27, 1, [9 0 4.2 0]);
Nodes = reprow(Nodes, 28:36, 1, [9 0 3.7 0]);
%STEP N2: the 3 top points of triangle, then copy to second triangle
Nodes= [Nodes;
46 31.5 0 14.5;
47 42 0 25;
48 52.5 0 14.5];
Nodes = reprow(Nodes, 46:48, 1, [3 0 12.9 0]);
%STEP N3: reprow the full triangle + deck two times
%no overlapping nodes
%second triangle + deck
Nodes = reprow(Nodes, 1:8,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 10:17,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 19:26,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 28:35,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 37:44,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 46:51,1,[51 42 0 0]);
%third triangle + deck
Nodes = reprow(Nodes, 1:8,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 10:17,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 19:26,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 28:35,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 37:44,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 46:51,1,[102 84 0 0]);
%STEP N4: add the other notes of the deck parts not directly supported by
%the triangles to the left and right
%The left
Nodes = [Nodes;
154 0 0 4;
155 5.25 0 4;
156 10.5 0 4;
157 15.75 0 4;
158 0 4.2 4;
159 5.25 4.2 4;
160 10.5 4.2 4;
161 15.75 4.2 4;
162 0 8.7 4;
163 5.25 8.7 4;
164 10.5 8.7 4;
165 15.75 8.7 4;
166 0 12.9 4;
167 5.25 12.9 4;
168 10.5 12.9 4;
169 15.75 12.9 4;
170 0 16.6 4;
171 5.25 16.6 4;
172 10.5 16.6 4;
173 15.75 16.6 4];
%The right
Nodes = [Nodes;
174 152.25 0 4;
175 157.5 0 4;
176 162.75 0 4;
177 168 0 4;
178 152.25 4.2 4;
179 157.5 4.2 4;
180 162.75 4.2 4;
181 168 4.2 4;
182 152.25 8.7 4;
183 157.5 8.7 4;
184 162.75 8.7 4;
185 168 8.7 4;
186 152.25 12.9 4;
187 157.5 12.9 4;
188 162.75 12.9 4;
189 168 12.9 4;
190 152.25 16.6 4;
191 157.5 16.6 4;
192 162.75 16.6 4;
193 168 16.6 4];
%STEP N5: reference nodes
%Longitudinal beams and diagonal beams triangle 1 to 47 and copies
Nodes= [Nodes;
500 0 0 100;
501 0 4.2 100;
502 0 8.7 100;
503 0 12.9 100;
504 0 16.6 100];
%Beam element from 47 to 9 and all the copies
%also the ones going from 46 to 5 and the copies
Nodes= [Nodes;
505 168 0 100;
506 168 12.9 100];
%Transversal beams
Nodes= [Nodes;
507 31.5 0 100;
508 42 0 100;
509 52.5 0 100;
510 31.5+42 0 100;
511 42+42 0 100;
512 52.5+42 0 100;
513 31.5+42*2 0 100;
514 42+42*2 0 100;
515 52.5+42*2 0 100];
%STEP E1: initializing
% Element types -> {EltTypID EltName}
Types= {1 ‘beam’;
2 ‘truss’};
% Sections=[SecID A ky kz Ixx Iyy Izz] !!!all in m
Sections = [1 0.265*0.990*2 Inf Inf 2*(1/12*0.265*0.990^3) 2*(1/12*0.265*0.990^3) 2*(1/12*0.265*0.990^3); % plywood king post beam
2 0.265*0.540*2 Inf Inf 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3); % plywood diagonal beam
3 0.265*0.540*2 Inf Inf 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3); % horizontal beam
4 ((0.314/2)^2*pi-(0.314/2-0.019)^2*pi) NaN NaN NaN NaN NaN; % steel vertical
5 ((0.314/2)^2*pi-(0.314/2-0.019)^2*pi) NaN NaN NaN NaN NaN; % diagonal steel truss (only A)
6 0.265*0.1350*2 Inf Inf 2*(1/12*0.265*0.1350^3) 2*(1/12*0.265*0.1350^3) 2*(1/12*0.265*0.1350^3); % outer deck beam
7 0.240*0.1350*2 Inf Inf 2*(1/12*0.240*0.1350^3) 2*(1/12*0.240*0.1350^3) 2*(1/12*0.240*0.1350^3); % inner deck beam
8 0.200*0.650 Inf Inf 1/12*0.200*0.650^3 1/12*0.200*0.650^3 1/12*0.200*0.650^3; % outer footbridge
9 0.100*0.100 NaN NaN NaN NaN NaN]; % deck truss steel
% Materials=[MatID E nu rho];
Materials= [1 7.75e6 0.2 2000; % plywood
2 210e6 0.3 7500]; % steel KN/m2
% Elements=[EltID TypID SecID MatID n1 n2 n3]
%STEP E2: deck longitudonal plywood beams
%First triangle
Elements= [1 1 6 1 1 2 500;
2 1 7 1 10 11 501;
3 1 7 1 19 20 502;
4 1 6 1 28 29 503;
5 1 8 1 37 38 504];
Elements=reprow(Elements,1:5,7,[5 0 0 0 1 1 0]);
%Second triangle
Elements=[Elements;
41 1 6 1 9 52 500;
42 1 7 1 18 61 501;
43 1 7 1 27 70 502;
44 1 6 1 36 79 503;
45 1 8 1 45 88 504];
Elements= [Elements;
46 1 6 1 52 53 500;
47 1 7 1 61 62 501;
48 1 7 1 70 71 502;
49 1 6 1 79 80 503;
50 1 8 1 88 89 504];
Elements=reprow(Elements,46:50,6,[5 0 0 0 1 1 0]);
%Third triangle
Elements=[Elements;
81 1 6 1 59 103 500;
82 1 7 1 68 112 501;
83 1 7 1 77 121 502;
84 1 6 1 86 130 503;
85 1 8 1 95 139 504];
Elements= [Elements;
86 1 6 1 103 104 500;
87 1 7 1 112 113 501;
88 1 7 1 121 122 502;
89 1 6 1 130 131 503;
90 1 8 1 139 140 504];
Elements=reprow(Elements,86:90,6,[5 0 0 0 1 1 0]);
%Deck on the right of the triangles
Elements= [Elements;
121 1 6 1 110 174 500;
122 1 7 1 119 178 501;
123 1 7 1 128 182 502;
124 1 6 1 137 186 503;
125 1 8 1 146 190 504];
Elements= [Elements;
126 1 6 1 174 175 500;
127 1 7 1 178 179 501;
128 1 7 1 182 183 502;
129 1 6 1 186 187 503;
130 1 8 1 190 191 504];
Elements=reprow(Elements,126:130,2,[5 0 0 0 1 1 0]);
%Deck on the left of the triangles
Elements= [Elements;
141 1 6 1 154 155 500;
142 1 7 1 158 159 501;
143 1 7 1 162 163 502;
144 1 6 1 166 167 503;
145 1 8 1 170 171 504];
Elements=reprow(Elements,141:145,2,[5 0 0 0 1 1 0]);
Elements= [Elements;
156 1 6 1 157 1 500;
157 1 7 1 161 10 501;
158 1 7 1 165 19 502;
159 1 6 1 169 28 503;
160 1 8 1 173 37 504];
%STEP E2: deck transversal steel trusses
%First triangle
Elements= [Elements;
161 2 9 1 1 10 NaN;
162 2 9 1 10 19 NaN;
163 2 9 1 19 28 NaN;
164 2 9 1 28 37 NaN];
Elements=reprow(Elements,161:164,8,[4 0 0 0 1 1 0]);
%Second triangle
Elements= [Elements;
197 2 9 1 52 61 NaN;
198 2 9 1 61 70 NaN;
199 2 9 1 70 79 NaN;
200 2 9 1 79 88 NaN];
Elements=reprow(Elements,197:200,7,[4 0 0 0 1 1 0]);
%Third triangle
Elements= [Elements;
229 2 9 1 103 112 NaN;
230 2 9 1 112 121 NaN;
231 2 9 1 121 130 NaN;
232 2 9 1 130 139 NaN];
Elements=reprow(Elements,229:232,7,[4 0 0 0 1 1 0]);
%Right of the triangles
Elements= [Elements;
261 2 9 1 174 178 NaN;
262 2 9 1 178 182 NaN;
263 2 9 1 182 186 NaN;
264 2 9 1 186 190 NaN];
Elements=reprow(Elements,261:264,3,[4 0 0 0 1 1 0]);
%Left of the triangles
Elements= [Elements;
277 2 9 1 154 158 NaN;
278 2 9 1 158 162 NaN;
279 2 9 1 162 166 NaN;
280 2 9 1 166 170 NaN];
Elements=reprow(Elements,277:280,3,[4 0 0 0 1 1 0]);
%STEP E3: Beams elements triangles
%Beam element from 1 to 47 and all the copies (king post truss up)
Elements= [Elements;
293 1 1 1 1 47 500;
294 1 1 1 9 98 500;
295 1 1 1 59 149 500;
296 1 1 1 28 50 503;
297 1 1 1 36 101 503;
298 1 1 1 86 152 503];
%Beam element from 47 to 9 and all the copies (king post truss down)
Elements= [Elements;
299 1 1 1 47 9 505;
300 1 1 1 98 59 505;
301 1 1 1 149 110 505;
302 1 1 1 50 36 506;
303 1 1 1 101 86 506;
304 1 1 1 152 137 506];
%Beam element from 5 to 48 and all the copies (side diagonal)
Elements= [Elements;
305 1 2 1 5 48 500;
306 1 2 1 55 99 500;
307 1 2 1 106 150 500;
308 1 2 1 32 51 503;
309 1 2 1 82 102 503;
310 1 2 1 133 153 503];
%Beam element from 46 to 5 and all the copies (side diagonal)
Elements= [Elements;
311 1 2 1 46 5 505;
312 1 2 1 97 55 505;
313 1 2 1 148 106 505;
314 1 2 1 49 32 506;
315 1 2 1 100 82 506;
316 1 2 1 151 133 506];
%Transversal beams between the triangles
Elements= [Elements;
317 1 3 1 46 49 507;
318 1 3 1 47 50 508;
319 1 3 1 48 51 509;
320 1 3 1 97 100 510;
321 1 3 1 98 101 511;
322 1 3 1 99 102 512;
323 1 3 1 148 151 513;
324 1 3 1 149 152 514;
325 1 3 1 150 153 515];
%STEP E4: Truss elements triangles
%Vertical steel trusses
%First triangle
Elements= [Elements;
326 2 4 2 46 3 NaN;
327 2 4 2 47 5 NaN;
328 2 4 2 48 7 NaN;
329 2 4 2 49 30 NaN;
330 2 4 2 50 32 NaN;
331 2 4 2 51 34 NaN];
%Second triangle
Elements= [Elements;
332 2 4 2 97 53 NaN;
333 2 4 2 98 55 NaN;
334 2 4 2 99 57 NaN;
335 2 4 2 100 80 NaN;
336 2 4 2 101 82 NaN;
337 2 4 2 102 84 NaN];
%Third triangle
Elements= [Elements;
338 2 4 2 148 104 NaN;
339 2 4 2 149 106 NaN;
340 2 4 2 150 108 NaN;
341 2 4 2 151 131 NaN;
342 2 4 2 152 133 NaN;
343 2 4 2 153 135 NaN];
%Diagonal trusses
%First triangle
Elements= [Elements;
344 2 5 2 46 50 NaN;
345 2 5 2 47 49 NaN;
346 2 5 2 47 51 NaN;
347 2 5 2 48 50 NaN];
%Second triangle
Elements= [Elements;
348 2 5 2 97 101 NaN;
349 2 5 2 101 99 NaN;
350 2 5 2 98 100 NaN;
351 2 5 2 98 102 NaN];
%Third triangle
Elements= [Elements;
352 2 5 2 148 152 NaN;
353 2 5 2 150 152 NaN;
354 2 5 2 149 151 NaN;
355 2 5 2 149 153 NaN];
%STEP E5: plot
figure
plotelem(Nodes,Elements(find(Elements(:,3)==1),:),Types,’bl’);
hold(‘on’);
plotelem(Nodes,Elements(find(Elements(:,3)==2),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==3),:),Types,’m’);
plotelem(Nodes,Elements(find(Elements(:,3)==4),:),Types,’r’);
plotelem(Nodes,Elements(find(Elements(:,3)==5),:),Types,’r’);
plotelem(Nodes,Elements(find(Elements(:,3)==6),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==7),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==8),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==9),:),Types,’r’);
title(‘Elements’)
figure
plotnodes(Nodes);
title(‘Nodes’)
%STEP D1: generate all possible DOF
DOFall = getdof(Elements,Types);
%STEP D2: remove the DOF limited by the boundary conditions
selnodes = [1;9;28;36;59;86;110;137;154;158;162;166;170;177;181;185;189;193];
dofpattern = [0.01 0.02 0.03]; % the three dof’s
seldof = selnodes + dofpattern; % for the selected nodes, the pattern of dof
seldof = seldof(:);
DOF = removedof(DOFall,seldof);
%STEP K1: assemble the K matrix
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
%STEP K2: check the K matrix
%check symmetry
disp(K-K’)
det(K)
issymmetric(K)
%positive definite
find(eig(K)<0)
%to check wheter invertible
%Now we assign the correct loads to the structure
%STEP L1: compute the self weight of the structure
% Own weight
DLoadsOwn=accel([0 0 9.81e-3],Elements,Types,Sections,Materials);
%STEP L2: compute the distributed load working on the deck
%Combine with own weight and turn into elemloads
%DLoads=[EltID n1globalX n1globalY n1globalZ …]
DLoadsTraffic = zeros([160 7]);
DLoadsTraffic =[DLoadsTraffic;
161 0 0 -2.5 0 0 -2.5;
162 0 0 -2.5 0 0 -2.5;
163 0 0 -2.5 0 0 -2.5;
164 0 0 -9 0 0 -9];
DLoadsTraffic=reprow(DLoadsTraffic,161:164,32,[4 0 0 0 0 0 0]);
DLoadsTraffic = [DLoadsTraffic;
zeros([355-292 7])];
DLoadsOwn(161:292,1)=0;
DLoads = DLoadsOwn + DLoadsTraffic
P=elemloads(DLoads,Nodes,Elements,Types,DOF);
%P = P1+P2
%STEP L3: compute the point loads working on the deck
% Nodal loads: 5 kN horizontally on node 4.
%seldof=[4.01];
%PLoad= [5];
% Assembly of the load vectors:
%P=nodalvalues(DOF,seldof,PLoad);
%PLoad=[0]
%seldof=[]
%Pp=nodalvalues(DOF,seldof,PLoad);
%STEP L4: Compute P
%STEP U1: Compute the displacements
U=KP;
% Plot displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U,’DispScal’,5)
title(‘Displacements’)
exportgraphics(gcf,’FE_DYB_Displ.jpg’,’Resolution’,300)
printdisp(Nodes,DOF,U);
% Compute element forces
Forces=elemforces(Nodes,Elements,Types,Sections,Materials,DOF,U,DLoads);
printforc(Elements,Forces);
% Plot element forces
figure
plotforc(‘norm’,Nodes,Elements,Types,Forces,DLoads)
title(‘Normal forces’)
exportgraphics(gcf,’FE_DYB_Normal.jpg’,’Resolution’,300)
figure
plotforc(‘sheary’,Nodes,Elements,Types,Forces,DLoads)
title(‘Shear forces’)
exportgraphics(gcf,’FE_DYB_Shear.jpg’,’Resolution’,300)
figure
plotforc(‘momz’,Nodes,Elements,Types,Forces,DLoads)
title(‘Bending moments’)
exportgraphics(gcf,’FE_DYB_Moment.jpg’,’Resolution’,300)We are working on a finite elements model using the plug-in STABIL. We get no errors but our displacements are all giving NaN as solution. Can someone explain the meaning of these NaNs? Our K and P matrix look logical so we are out of options…
%initializing
clc
close all
clear all
% units kN,m
unzip(‘stabil-3.1.zip’);
% CALCULATING THE NODES
%STEP N1: the deck
% Nodes=[NodID X Y Z]
Nodes= [1 21 0 4;
2 21+5.25*1 0 4;
3 21+5.25*2 0 4;
4 21+5.25*3 0 4;
5 21+5.25*4 0 4;
6 21+5.25*5 0 4;
7 21+5.25*6 0 4;
8 21+5.25*7 0 4;
9 21+5.25*8 0 4];
Nodes = reprow(Nodes, 1:9, 1, [9 0 4.2 0]);
Nodes = reprow(Nodes, 10:18, 1, [9 0 4.5 0]);
Nodes = reprow(Nodes, 19:27, 1, [9 0 4.2 0]);
Nodes = reprow(Nodes, 28:36, 1, [9 0 3.7 0]);
%STEP N2: the 3 top points of triangle, then copy to second triangle
Nodes= [Nodes;
46 31.5 0 14.5;
47 42 0 25;
48 52.5 0 14.5];
Nodes = reprow(Nodes, 46:48, 1, [3 0 12.9 0]);
%STEP N3: reprow the full triangle + deck two times
%no overlapping nodes
%second triangle + deck
Nodes = reprow(Nodes, 1:8,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 10:17,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 19:26,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 28:35,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 37:44,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 46:51,1,[51 42 0 0]);
%third triangle + deck
Nodes = reprow(Nodes, 1:8,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 10:17,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 19:26,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 28:35,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 37:44,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 46:51,1,[102 84 0 0]);
%STEP N4: add the other notes of the deck parts not directly supported by
%the triangles to the left and right
%The left
Nodes = [Nodes;
154 0 0 4;
155 5.25 0 4;
156 10.5 0 4;
157 15.75 0 4;
158 0 4.2 4;
159 5.25 4.2 4;
160 10.5 4.2 4;
161 15.75 4.2 4;
162 0 8.7 4;
163 5.25 8.7 4;
164 10.5 8.7 4;
165 15.75 8.7 4;
166 0 12.9 4;
167 5.25 12.9 4;
168 10.5 12.9 4;
169 15.75 12.9 4;
170 0 16.6 4;
171 5.25 16.6 4;
172 10.5 16.6 4;
173 15.75 16.6 4];
%The right
Nodes = [Nodes;
174 152.25 0 4;
175 157.5 0 4;
176 162.75 0 4;
177 168 0 4;
178 152.25 4.2 4;
179 157.5 4.2 4;
180 162.75 4.2 4;
181 168 4.2 4;
182 152.25 8.7 4;
183 157.5 8.7 4;
184 162.75 8.7 4;
185 168 8.7 4;
186 152.25 12.9 4;
187 157.5 12.9 4;
188 162.75 12.9 4;
189 168 12.9 4;
190 152.25 16.6 4;
191 157.5 16.6 4;
192 162.75 16.6 4;
193 168 16.6 4];
%STEP N5: reference nodes
%Longitudinal beams and diagonal beams triangle 1 to 47 and copies
Nodes= [Nodes;
500 0 0 100;
501 0 4.2 100;
502 0 8.7 100;
503 0 12.9 100;
504 0 16.6 100];
%Beam element from 47 to 9 and all the copies
%also the ones going from 46 to 5 and the copies
Nodes= [Nodes;
505 168 0 100;
506 168 12.9 100];
%Transversal beams
Nodes= [Nodes;
507 31.5 0 100;
508 42 0 100;
509 52.5 0 100;
510 31.5+42 0 100;
511 42+42 0 100;
512 52.5+42 0 100;
513 31.5+42*2 0 100;
514 42+42*2 0 100;
515 52.5+42*2 0 100];
%STEP E1: initializing
% Element types -> {EltTypID EltName}
Types= {1 ‘beam’;
2 ‘truss’};
% Sections=[SecID A ky kz Ixx Iyy Izz] !!!all in m
Sections = [1 0.265*0.990*2 Inf Inf 2*(1/12*0.265*0.990^3) 2*(1/12*0.265*0.990^3) 2*(1/12*0.265*0.990^3); % plywood king post beam
2 0.265*0.540*2 Inf Inf 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3); % plywood diagonal beam
3 0.265*0.540*2 Inf Inf 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3); % horizontal beam
4 ((0.314/2)^2*pi-(0.314/2-0.019)^2*pi) NaN NaN NaN NaN NaN; % steel vertical
5 ((0.314/2)^2*pi-(0.314/2-0.019)^2*pi) NaN NaN NaN NaN NaN; % diagonal steel truss (only A)
6 0.265*0.1350*2 Inf Inf 2*(1/12*0.265*0.1350^3) 2*(1/12*0.265*0.1350^3) 2*(1/12*0.265*0.1350^3); % outer deck beam
7 0.240*0.1350*2 Inf Inf 2*(1/12*0.240*0.1350^3) 2*(1/12*0.240*0.1350^3) 2*(1/12*0.240*0.1350^3); % inner deck beam
8 0.200*0.650 Inf Inf 1/12*0.200*0.650^3 1/12*0.200*0.650^3 1/12*0.200*0.650^3; % outer footbridge
9 0.100*0.100 NaN NaN NaN NaN NaN]; % deck truss steel
% Materials=[MatID E nu rho];
Materials= [1 7.75e6 0.2 2000; % plywood
2 210e6 0.3 7500]; % steel KN/m2
% Elements=[EltID TypID SecID MatID n1 n2 n3]
%STEP E2: deck longitudonal plywood beams
%First triangle
Elements= [1 1 6 1 1 2 500;
2 1 7 1 10 11 501;
3 1 7 1 19 20 502;
4 1 6 1 28 29 503;
5 1 8 1 37 38 504];
Elements=reprow(Elements,1:5,7,[5 0 0 0 1 1 0]);
%Second triangle
Elements=[Elements;
41 1 6 1 9 52 500;
42 1 7 1 18 61 501;
43 1 7 1 27 70 502;
44 1 6 1 36 79 503;
45 1 8 1 45 88 504];
Elements= [Elements;
46 1 6 1 52 53 500;
47 1 7 1 61 62 501;
48 1 7 1 70 71 502;
49 1 6 1 79 80 503;
50 1 8 1 88 89 504];
Elements=reprow(Elements,46:50,6,[5 0 0 0 1 1 0]);
%Third triangle
Elements=[Elements;
81 1 6 1 59 103 500;
82 1 7 1 68 112 501;
83 1 7 1 77 121 502;
84 1 6 1 86 130 503;
85 1 8 1 95 139 504];
Elements= [Elements;
86 1 6 1 103 104 500;
87 1 7 1 112 113 501;
88 1 7 1 121 122 502;
89 1 6 1 130 131 503;
90 1 8 1 139 140 504];
Elements=reprow(Elements,86:90,6,[5 0 0 0 1 1 0]);
%Deck on the right of the triangles
Elements= [Elements;
121 1 6 1 110 174 500;
122 1 7 1 119 178 501;
123 1 7 1 128 182 502;
124 1 6 1 137 186 503;
125 1 8 1 146 190 504];
Elements= [Elements;
126 1 6 1 174 175 500;
127 1 7 1 178 179 501;
128 1 7 1 182 183 502;
129 1 6 1 186 187 503;
130 1 8 1 190 191 504];
Elements=reprow(Elements,126:130,2,[5 0 0 0 1 1 0]);
%Deck on the left of the triangles
Elements= [Elements;
141 1 6 1 154 155 500;
142 1 7 1 158 159 501;
143 1 7 1 162 163 502;
144 1 6 1 166 167 503;
145 1 8 1 170 171 504];
Elements=reprow(Elements,141:145,2,[5 0 0 0 1 1 0]);
Elements= [Elements;
156 1 6 1 157 1 500;
157 1 7 1 161 10 501;
158 1 7 1 165 19 502;
159 1 6 1 169 28 503;
160 1 8 1 173 37 504];
%STEP E2: deck transversal steel trusses
%First triangle
Elements= [Elements;
161 2 9 1 1 10 NaN;
162 2 9 1 10 19 NaN;
163 2 9 1 19 28 NaN;
164 2 9 1 28 37 NaN];
Elements=reprow(Elements,161:164,8,[4 0 0 0 1 1 0]);
%Second triangle
Elements= [Elements;
197 2 9 1 52 61 NaN;
198 2 9 1 61 70 NaN;
199 2 9 1 70 79 NaN;
200 2 9 1 79 88 NaN];
Elements=reprow(Elements,197:200,7,[4 0 0 0 1 1 0]);
%Third triangle
Elements= [Elements;
229 2 9 1 103 112 NaN;
230 2 9 1 112 121 NaN;
231 2 9 1 121 130 NaN;
232 2 9 1 130 139 NaN];
Elements=reprow(Elements,229:232,7,[4 0 0 0 1 1 0]);
%Right of the triangles
Elements= [Elements;
261 2 9 1 174 178 NaN;
262 2 9 1 178 182 NaN;
263 2 9 1 182 186 NaN;
264 2 9 1 186 190 NaN];
Elements=reprow(Elements,261:264,3,[4 0 0 0 1 1 0]);
%Left of the triangles
Elements= [Elements;
277 2 9 1 154 158 NaN;
278 2 9 1 158 162 NaN;
279 2 9 1 162 166 NaN;
280 2 9 1 166 170 NaN];
Elements=reprow(Elements,277:280,3,[4 0 0 0 1 1 0]);
%STEP E3: Beams elements triangles
%Beam element from 1 to 47 and all the copies (king post truss up)
Elements= [Elements;
293 1 1 1 1 47 500;
294 1 1 1 9 98 500;
295 1 1 1 59 149 500;
296 1 1 1 28 50 503;
297 1 1 1 36 101 503;
298 1 1 1 86 152 503];
%Beam element from 47 to 9 and all the copies (king post truss down)
Elements= [Elements;
299 1 1 1 47 9 505;
300 1 1 1 98 59 505;
301 1 1 1 149 110 505;
302 1 1 1 50 36 506;
303 1 1 1 101 86 506;
304 1 1 1 152 137 506];
%Beam element from 5 to 48 and all the copies (side diagonal)
Elements= [Elements;
305 1 2 1 5 48 500;
306 1 2 1 55 99 500;
307 1 2 1 106 150 500;
308 1 2 1 32 51 503;
309 1 2 1 82 102 503;
310 1 2 1 133 153 503];
%Beam element from 46 to 5 and all the copies (side diagonal)
Elements= [Elements;
311 1 2 1 46 5 505;
312 1 2 1 97 55 505;
313 1 2 1 148 106 505;
314 1 2 1 49 32 506;
315 1 2 1 100 82 506;
316 1 2 1 151 133 506];
%Transversal beams between the triangles
Elements= [Elements;
317 1 3 1 46 49 507;
318 1 3 1 47 50 508;
319 1 3 1 48 51 509;
320 1 3 1 97 100 510;
321 1 3 1 98 101 511;
322 1 3 1 99 102 512;
323 1 3 1 148 151 513;
324 1 3 1 149 152 514;
325 1 3 1 150 153 515];
%STEP E4: Truss elements triangles
%Vertical steel trusses
%First triangle
Elements= [Elements;
326 2 4 2 46 3 NaN;
327 2 4 2 47 5 NaN;
328 2 4 2 48 7 NaN;
329 2 4 2 49 30 NaN;
330 2 4 2 50 32 NaN;
331 2 4 2 51 34 NaN];
%Second triangle
Elements= [Elements;
332 2 4 2 97 53 NaN;
333 2 4 2 98 55 NaN;
334 2 4 2 99 57 NaN;
335 2 4 2 100 80 NaN;
336 2 4 2 101 82 NaN;
337 2 4 2 102 84 NaN];
%Third triangle
Elements= [Elements;
338 2 4 2 148 104 NaN;
339 2 4 2 149 106 NaN;
340 2 4 2 150 108 NaN;
341 2 4 2 151 131 NaN;
342 2 4 2 152 133 NaN;
343 2 4 2 153 135 NaN];
%Diagonal trusses
%First triangle
Elements= [Elements;
344 2 5 2 46 50 NaN;
345 2 5 2 47 49 NaN;
346 2 5 2 47 51 NaN;
347 2 5 2 48 50 NaN];
%Second triangle
Elements= [Elements;
348 2 5 2 97 101 NaN;
349 2 5 2 101 99 NaN;
350 2 5 2 98 100 NaN;
351 2 5 2 98 102 NaN];
%Third triangle
Elements= [Elements;
352 2 5 2 148 152 NaN;
353 2 5 2 150 152 NaN;
354 2 5 2 149 151 NaN;
355 2 5 2 149 153 NaN];
%STEP E5: plot
figure
plotelem(Nodes,Elements(find(Elements(:,3)==1),:),Types,’bl’);
hold(‘on’);
plotelem(Nodes,Elements(find(Elements(:,3)==2),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==3),:),Types,’m’);
plotelem(Nodes,Elements(find(Elements(:,3)==4),:),Types,’r’);
plotelem(Nodes,Elements(find(Elements(:,3)==5),:),Types,’r’);
plotelem(Nodes,Elements(find(Elements(:,3)==6),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==7),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==8),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==9),:),Types,’r’);
title(‘Elements’)
figure
plotnodes(Nodes);
title(‘Nodes’)
%STEP D1: generate all possible DOF
DOFall = getdof(Elements,Types);
%STEP D2: remove the DOF limited by the boundary conditions
selnodes = [1;9;28;36;59;86;110;137;154;158;162;166;170;177;181;185;189;193];
dofpattern = [0.01 0.02 0.03]; % the three dof’s
seldof = selnodes + dofpattern; % for the selected nodes, the pattern of dof
seldof = seldof(:);
DOF = removedof(DOFall,seldof);
%STEP K1: assemble the K matrix
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
%STEP K2: check the K matrix
%check symmetry
disp(K-K’)
det(K)
issymmetric(K)
%positive definite
find(eig(K)<0)
%to check wheter invertible
%Now we assign the correct loads to the structure
%STEP L1: compute the self weight of the structure
% Own weight
DLoadsOwn=accel([0 0 9.81e-3],Elements,Types,Sections,Materials);
%STEP L2: compute the distributed load working on the deck
%Combine with own weight and turn into elemloads
%DLoads=[EltID n1globalX n1globalY n1globalZ …]
DLoadsTraffic = zeros([160 7]);
DLoadsTraffic =[DLoadsTraffic;
161 0 0 -2.5 0 0 -2.5;
162 0 0 -2.5 0 0 -2.5;
163 0 0 -2.5 0 0 -2.5;
164 0 0 -9 0 0 -9];
DLoadsTraffic=reprow(DLoadsTraffic,161:164,32,[4 0 0 0 0 0 0]);
DLoadsTraffic = [DLoadsTraffic;
zeros([355-292 7])];
DLoadsOwn(161:292,1)=0;
DLoads = DLoadsOwn + DLoadsTraffic
P=elemloads(DLoads,Nodes,Elements,Types,DOF);
%P = P1+P2
%STEP L3: compute the point loads working on the deck
% Nodal loads: 5 kN horizontally on node 4.
%seldof=[4.01];
%PLoad= [5];
% Assembly of the load vectors:
%P=nodalvalues(DOF,seldof,PLoad);
%PLoad=[0]
%seldof=[]
%Pp=nodalvalues(DOF,seldof,PLoad);
%STEP L4: Compute P
%STEP U1: Compute the displacements
U=KP;
% Plot displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U,’DispScal’,5)
title(‘Displacements’)
exportgraphics(gcf,’FE_DYB_Displ.jpg’,’Resolution’,300)
printdisp(Nodes,DOF,U);
% Compute element forces
Forces=elemforces(Nodes,Elements,Types,Sections,Materials,DOF,U,DLoads);
printforc(Elements,Forces);
% Plot element forces
figure
plotforc(‘norm’,Nodes,Elements,Types,Forces,DLoads)
title(‘Normal forces’)
exportgraphics(gcf,’FE_DYB_Normal.jpg’,’Resolution’,300)
figure
plotforc(‘sheary’,Nodes,Elements,Types,Forces,DLoads)
title(‘Shear forces’)
exportgraphics(gcf,’FE_DYB_Shear.jpg’,’Resolution’,300)
figure
plotforc(‘momz’,Nodes,Elements,Types,Forces,DLoads)
title(‘Bending moments’)
exportgraphics(gcf,’FE_DYB_Moment.jpg’,’Resolution’,300) We are working on a finite elements model using the plug-in STABIL. We get no errors but our displacements are all giving NaN as solution. Can someone explain the meaning of these NaNs? Our K and P matrix look logical so we are out of options…
%initializing
clc
close all
clear all
% units kN,m
unzip(‘stabil-3.1.zip’);
% CALCULATING THE NODES
%STEP N1: the deck
% Nodes=[NodID X Y Z]
Nodes= [1 21 0 4;
2 21+5.25*1 0 4;
3 21+5.25*2 0 4;
4 21+5.25*3 0 4;
5 21+5.25*4 0 4;
6 21+5.25*5 0 4;
7 21+5.25*6 0 4;
8 21+5.25*7 0 4;
9 21+5.25*8 0 4];
Nodes = reprow(Nodes, 1:9, 1, [9 0 4.2 0]);
Nodes = reprow(Nodes, 10:18, 1, [9 0 4.5 0]);
Nodes = reprow(Nodes, 19:27, 1, [9 0 4.2 0]);
Nodes = reprow(Nodes, 28:36, 1, [9 0 3.7 0]);
%STEP N2: the 3 top points of triangle, then copy to second triangle
Nodes= [Nodes;
46 31.5 0 14.5;
47 42 0 25;
48 52.5 0 14.5];
Nodes = reprow(Nodes, 46:48, 1, [3 0 12.9 0]);
%STEP N3: reprow the full triangle + deck two times
%no overlapping nodes
%second triangle + deck
Nodes = reprow(Nodes, 1:8,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 10:17,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 19:26,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 28:35,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 37:44,1,[51 47.25 0 0]);
Nodes = reprow(Nodes, 46:51,1,[51 42 0 0]);
%third triangle + deck
Nodes = reprow(Nodes, 1:8,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 10:17,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 19:26,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 28:35,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 37:44,1,[102 89.25 0 0]);
Nodes = reprow(Nodes, 46:51,1,[102 84 0 0]);
%STEP N4: add the other notes of the deck parts not directly supported by
%the triangles to the left and right
%The left
Nodes = [Nodes;
154 0 0 4;
155 5.25 0 4;
156 10.5 0 4;
157 15.75 0 4;
158 0 4.2 4;
159 5.25 4.2 4;
160 10.5 4.2 4;
161 15.75 4.2 4;
162 0 8.7 4;
163 5.25 8.7 4;
164 10.5 8.7 4;
165 15.75 8.7 4;
166 0 12.9 4;
167 5.25 12.9 4;
168 10.5 12.9 4;
169 15.75 12.9 4;
170 0 16.6 4;
171 5.25 16.6 4;
172 10.5 16.6 4;
173 15.75 16.6 4];
%The right
Nodes = [Nodes;
174 152.25 0 4;
175 157.5 0 4;
176 162.75 0 4;
177 168 0 4;
178 152.25 4.2 4;
179 157.5 4.2 4;
180 162.75 4.2 4;
181 168 4.2 4;
182 152.25 8.7 4;
183 157.5 8.7 4;
184 162.75 8.7 4;
185 168 8.7 4;
186 152.25 12.9 4;
187 157.5 12.9 4;
188 162.75 12.9 4;
189 168 12.9 4;
190 152.25 16.6 4;
191 157.5 16.6 4;
192 162.75 16.6 4;
193 168 16.6 4];
%STEP N5: reference nodes
%Longitudinal beams and diagonal beams triangle 1 to 47 and copies
Nodes= [Nodes;
500 0 0 100;
501 0 4.2 100;
502 0 8.7 100;
503 0 12.9 100;
504 0 16.6 100];
%Beam element from 47 to 9 and all the copies
%also the ones going from 46 to 5 and the copies
Nodes= [Nodes;
505 168 0 100;
506 168 12.9 100];
%Transversal beams
Nodes= [Nodes;
507 31.5 0 100;
508 42 0 100;
509 52.5 0 100;
510 31.5+42 0 100;
511 42+42 0 100;
512 52.5+42 0 100;
513 31.5+42*2 0 100;
514 42+42*2 0 100;
515 52.5+42*2 0 100];
%STEP E1: initializing
% Element types -> {EltTypID EltName}
Types= {1 ‘beam’;
2 ‘truss’};
% Sections=[SecID A ky kz Ixx Iyy Izz] !!!all in m
Sections = [1 0.265*0.990*2 Inf Inf 2*(1/12*0.265*0.990^3) 2*(1/12*0.265*0.990^3) 2*(1/12*0.265*0.990^3); % plywood king post beam
2 0.265*0.540*2 Inf Inf 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3); % plywood diagonal beam
3 0.265*0.540*2 Inf Inf 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3) 2*(1/12*0.265*0.540^3); % horizontal beam
4 ((0.314/2)^2*pi-(0.314/2-0.019)^2*pi) NaN NaN NaN NaN NaN; % steel vertical
5 ((0.314/2)^2*pi-(0.314/2-0.019)^2*pi) NaN NaN NaN NaN NaN; % diagonal steel truss (only A)
6 0.265*0.1350*2 Inf Inf 2*(1/12*0.265*0.1350^3) 2*(1/12*0.265*0.1350^3) 2*(1/12*0.265*0.1350^3); % outer deck beam
7 0.240*0.1350*2 Inf Inf 2*(1/12*0.240*0.1350^3) 2*(1/12*0.240*0.1350^3) 2*(1/12*0.240*0.1350^3); % inner deck beam
8 0.200*0.650 Inf Inf 1/12*0.200*0.650^3 1/12*0.200*0.650^3 1/12*0.200*0.650^3; % outer footbridge
9 0.100*0.100 NaN NaN NaN NaN NaN]; % deck truss steel
% Materials=[MatID E nu rho];
Materials= [1 7.75e6 0.2 2000; % plywood
2 210e6 0.3 7500]; % steel KN/m2
% Elements=[EltID TypID SecID MatID n1 n2 n3]
%STEP E2: deck longitudonal plywood beams
%First triangle
Elements= [1 1 6 1 1 2 500;
2 1 7 1 10 11 501;
3 1 7 1 19 20 502;
4 1 6 1 28 29 503;
5 1 8 1 37 38 504];
Elements=reprow(Elements,1:5,7,[5 0 0 0 1 1 0]);
%Second triangle
Elements=[Elements;
41 1 6 1 9 52 500;
42 1 7 1 18 61 501;
43 1 7 1 27 70 502;
44 1 6 1 36 79 503;
45 1 8 1 45 88 504];
Elements= [Elements;
46 1 6 1 52 53 500;
47 1 7 1 61 62 501;
48 1 7 1 70 71 502;
49 1 6 1 79 80 503;
50 1 8 1 88 89 504];
Elements=reprow(Elements,46:50,6,[5 0 0 0 1 1 0]);
%Third triangle
Elements=[Elements;
81 1 6 1 59 103 500;
82 1 7 1 68 112 501;
83 1 7 1 77 121 502;
84 1 6 1 86 130 503;
85 1 8 1 95 139 504];
Elements= [Elements;
86 1 6 1 103 104 500;
87 1 7 1 112 113 501;
88 1 7 1 121 122 502;
89 1 6 1 130 131 503;
90 1 8 1 139 140 504];
Elements=reprow(Elements,86:90,6,[5 0 0 0 1 1 0]);
%Deck on the right of the triangles
Elements= [Elements;
121 1 6 1 110 174 500;
122 1 7 1 119 178 501;
123 1 7 1 128 182 502;
124 1 6 1 137 186 503;
125 1 8 1 146 190 504];
Elements= [Elements;
126 1 6 1 174 175 500;
127 1 7 1 178 179 501;
128 1 7 1 182 183 502;
129 1 6 1 186 187 503;
130 1 8 1 190 191 504];
Elements=reprow(Elements,126:130,2,[5 0 0 0 1 1 0]);
%Deck on the left of the triangles
Elements= [Elements;
141 1 6 1 154 155 500;
142 1 7 1 158 159 501;
143 1 7 1 162 163 502;
144 1 6 1 166 167 503;
145 1 8 1 170 171 504];
Elements=reprow(Elements,141:145,2,[5 0 0 0 1 1 0]);
Elements= [Elements;
156 1 6 1 157 1 500;
157 1 7 1 161 10 501;
158 1 7 1 165 19 502;
159 1 6 1 169 28 503;
160 1 8 1 173 37 504];
%STEP E2: deck transversal steel trusses
%First triangle
Elements= [Elements;
161 2 9 1 1 10 NaN;
162 2 9 1 10 19 NaN;
163 2 9 1 19 28 NaN;
164 2 9 1 28 37 NaN];
Elements=reprow(Elements,161:164,8,[4 0 0 0 1 1 0]);
%Second triangle
Elements= [Elements;
197 2 9 1 52 61 NaN;
198 2 9 1 61 70 NaN;
199 2 9 1 70 79 NaN;
200 2 9 1 79 88 NaN];
Elements=reprow(Elements,197:200,7,[4 0 0 0 1 1 0]);
%Third triangle
Elements= [Elements;
229 2 9 1 103 112 NaN;
230 2 9 1 112 121 NaN;
231 2 9 1 121 130 NaN;
232 2 9 1 130 139 NaN];
Elements=reprow(Elements,229:232,7,[4 0 0 0 1 1 0]);
%Right of the triangles
Elements= [Elements;
261 2 9 1 174 178 NaN;
262 2 9 1 178 182 NaN;
263 2 9 1 182 186 NaN;
264 2 9 1 186 190 NaN];
Elements=reprow(Elements,261:264,3,[4 0 0 0 1 1 0]);
%Left of the triangles
Elements= [Elements;
277 2 9 1 154 158 NaN;
278 2 9 1 158 162 NaN;
279 2 9 1 162 166 NaN;
280 2 9 1 166 170 NaN];
Elements=reprow(Elements,277:280,3,[4 0 0 0 1 1 0]);
%STEP E3: Beams elements triangles
%Beam element from 1 to 47 and all the copies (king post truss up)
Elements= [Elements;
293 1 1 1 1 47 500;
294 1 1 1 9 98 500;
295 1 1 1 59 149 500;
296 1 1 1 28 50 503;
297 1 1 1 36 101 503;
298 1 1 1 86 152 503];
%Beam element from 47 to 9 and all the copies (king post truss down)
Elements= [Elements;
299 1 1 1 47 9 505;
300 1 1 1 98 59 505;
301 1 1 1 149 110 505;
302 1 1 1 50 36 506;
303 1 1 1 101 86 506;
304 1 1 1 152 137 506];
%Beam element from 5 to 48 and all the copies (side diagonal)
Elements= [Elements;
305 1 2 1 5 48 500;
306 1 2 1 55 99 500;
307 1 2 1 106 150 500;
308 1 2 1 32 51 503;
309 1 2 1 82 102 503;
310 1 2 1 133 153 503];
%Beam element from 46 to 5 and all the copies (side diagonal)
Elements= [Elements;
311 1 2 1 46 5 505;
312 1 2 1 97 55 505;
313 1 2 1 148 106 505;
314 1 2 1 49 32 506;
315 1 2 1 100 82 506;
316 1 2 1 151 133 506];
%Transversal beams between the triangles
Elements= [Elements;
317 1 3 1 46 49 507;
318 1 3 1 47 50 508;
319 1 3 1 48 51 509;
320 1 3 1 97 100 510;
321 1 3 1 98 101 511;
322 1 3 1 99 102 512;
323 1 3 1 148 151 513;
324 1 3 1 149 152 514;
325 1 3 1 150 153 515];
%STEP E4: Truss elements triangles
%Vertical steel trusses
%First triangle
Elements= [Elements;
326 2 4 2 46 3 NaN;
327 2 4 2 47 5 NaN;
328 2 4 2 48 7 NaN;
329 2 4 2 49 30 NaN;
330 2 4 2 50 32 NaN;
331 2 4 2 51 34 NaN];
%Second triangle
Elements= [Elements;
332 2 4 2 97 53 NaN;
333 2 4 2 98 55 NaN;
334 2 4 2 99 57 NaN;
335 2 4 2 100 80 NaN;
336 2 4 2 101 82 NaN;
337 2 4 2 102 84 NaN];
%Third triangle
Elements= [Elements;
338 2 4 2 148 104 NaN;
339 2 4 2 149 106 NaN;
340 2 4 2 150 108 NaN;
341 2 4 2 151 131 NaN;
342 2 4 2 152 133 NaN;
343 2 4 2 153 135 NaN];
%Diagonal trusses
%First triangle
Elements= [Elements;
344 2 5 2 46 50 NaN;
345 2 5 2 47 49 NaN;
346 2 5 2 47 51 NaN;
347 2 5 2 48 50 NaN];
%Second triangle
Elements= [Elements;
348 2 5 2 97 101 NaN;
349 2 5 2 101 99 NaN;
350 2 5 2 98 100 NaN;
351 2 5 2 98 102 NaN];
%Third triangle
Elements= [Elements;
352 2 5 2 148 152 NaN;
353 2 5 2 150 152 NaN;
354 2 5 2 149 151 NaN;
355 2 5 2 149 153 NaN];
%STEP E5: plot
figure
plotelem(Nodes,Elements(find(Elements(:,3)==1),:),Types,’bl’);
hold(‘on’);
plotelem(Nodes,Elements(find(Elements(:,3)==2),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==3),:),Types,’m’);
plotelem(Nodes,Elements(find(Elements(:,3)==4),:),Types,’r’);
plotelem(Nodes,Elements(find(Elements(:,3)==5),:),Types,’r’);
plotelem(Nodes,Elements(find(Elements(:,3)==6),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==7),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==8),:),Types,’bl’);
plotelem(Nodes,Elements(find(Elements(:,3)==9),:),Types,’r’);
title(‘Elements’)
figure
plotnodes(Nodes);
title(‘Nodes’)
%STEP D1: generate all possible DOF
DOFall = getdof(Elements,Types);
%STEP D2: remove the DOF limited by the boundary conditions
selnodes = [1;9;28;36;59;86;110;137;154;158;162;166;170;177;181;185;189;193];
dofpattern = [0.01 0.02 0.03]; % the three dof’s
seldof = selnodes + dofpattern; % for the selected nodes, the pattern of dof
seldof = seldof(:);
DOF = removedof(DOFall,seldof);
%STEP K1: assemble the K matrix
K = asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
%STEP K2: check the K matrix
%check symmetry
disp(K-K’)
det(K)
issymmetric(K)
%positive definite
find(eig(K)<0)
%to check wheter invertible
%Now we assign the correct loads to the structure
%STEP L1: compute the self weight of the structure
% Own weight
DLoadsOwn=accel([0 0 9.81e-3],Elements,Types,Sections,Materials);
%STEP L2: compute the distributed load working on the deck
%Combine with own weight and turn into elemloads
%DLoads=[EltID n1globalX n1globalY n1globalZ …]
DLoadsTraffic = zeros([160 7]);
DLoadsTraffic =[DLoadsTraffic;
161 0 0 -2.5 0 0 -2.5;
162 0 0 -2.5 0 0 -2.5;
163 0 0 -2.5 0 0 -2.5;
164 0 0 -9 0 0 -9];
DLoadsTraffic=reprow(DLoadsTraffic,161:164,32,[4 0 0 0 0 0 0]);
DLoadsTraffic = [DLoadsTraffic;
zeros([355-292 7])];
DLoadsOwn(161:292,1)=0;
DLoads = DLoadsOwn + DLoadsTraffic
P=elemloads(DLoads,Nodes,Elements,Types,DOF);
%P = P1+P2
%STEP L3: compute the point loads working on the deck
% Nodal loads: 5 kN horizontally on node 4.
%seldof=[4.01];
%PLoad= [5];
% Assembly of the load vectors:
%P=nodalvalues(DOF,seldof,PLoad);
%PLoad=[0]
%seldof=[]
%Pp=nodalvalues(DOF,seldof,PLoad);
%STEP L4: Compute P
%STEP U1: Compute the displacements
U=KP;
% Plot displacements
figure
plotdisp(Nodes,Elements,Types,DOF,U,’DispScal’,5)
title(‘Displacements’)
exportgraphics(gcf,’FE_DYB_Displ.jpg’,’Resolution’,300)
printdisp(Nodes,DOF,U);
% Compute element forces
Forces=elemforces(Nodes,Elements,Types,Sections,Materials,DOF,U,DLoads);
printforc(Elements,Forces);
% Plot element forces
figure
plotforc(‘norm’,Nodes,Elements,Types,Forces,DLoads)
title(‘Normal forces’)
exportgraphics(gcf,’FE_DYB_Normal.jpg’,’Resolution’,300)
figure
plotforc(‘sheary’,Nodes,Elements,Types,Forces,DLoads)
title(‘Shear forces’)
exportgraphics(gcf,’FE_DYB_Shear.jpg’,’Resolution’,300)
figure
plotforc(‘momz’,Nodes,Elements,Types,Forces,DLoads)
title(‘Bending moments’)
exportgraphics(gcf,’FE_DYB_Moment.jpg’,’Resolution’,300) stabil, finite elements, structures, nan MATLAB Answers — New Questions
Why isn’t this breaking the loop?
I have tried to use an ouptut argument to make a variable and use that variable in my main script, however when it is returning the value I want, it still isnt breaking the while loop?
Code for the function:
function continueChoice = cont()
continueChoice = listdlg("SelectionMode", "single", "ListString", ["Continue", "Exit"], "PromptString", "Would you like another statistic?")
end
Code in the main script:
data = readtable(‘alltimeteams.xlsx’,’VariableNamingRule’,’preserve’);
x = 0
while le(x,210)
x = x+1
choice=listdlg(‘SelectionMode’,’single’, ‘ListString’,data.Franchise,’PromptString’,’Please choose a franchise’); % all possible franchises
if isempty(choice)
fprintf("Please choose a franchise next time n")
break; % Exit the loop if no franchise is chosen
end
% the following is the problematic part
Wpercentchoice = listdlg("SelectionMode","single","PromptString","Would you like the win%?","ListString",["Yes","No"]);
if Wpercentchoice == 1
WinPercentcalc(data,choice); % calculates the overall win percentage (seperate function)
cont()
end
if isempty(continueChoice)
fprintf("Thank you!") % exit the loop if another statistic is not wanted
break;
elseif continueChoice == 2
fprintf("Thank you!") % exit the loop if another statistic is not wanted
break;
end
This is what shows in the command window after selecting "exit" in the listdlg
continueChoice =
2
ans =
2
continueChoice is 2, so shouldnt it work? It just carries on with the rest of my code instead.
Please lmk if any more info is needed.
P.S the reason I’ve made a function which is so short is because one of the criteria for the project im doing is that it has to have a function which has an ouptut argument and this is the only thing I could make one for , I understand it’d be a lot easier just doing it in the main script.I have tried to use an ouptut argument to make a variable and use that variable in my main script, however when it is returning the value I want, it still isnt breaking the while loop?
Code for the function:
function continueChoice = cont()
continueChoice = listdlg("SelectionMode", "single", "ListString", ["Continue", "Exit"], "PromptString", "Would you like another statistic?")
end
Code in the main script:
data = readtable(‘alltimeteams.xlsx’,’VariableNamingRule’,’preserve’);
x = 0
while le(x,210)
x = x+1
choice=listdlg(‘SelectionMode’,’single’, ‘ListString’,data.Franchise,’PromptString’,’Please choose a franchise’); % all possible franchises
if isempty(choice)
fprintf("Please choose a franchise next time n")
break; % Exit the loop if no franchise is chosen
end
% the following is the problematic part
Wpercentchoice = listdlg("SelectionMode","single","PromptString","Would you like the win%?","ListString",["Yes","No"]);
if Wpercentchoice == 1
WinPercentcalc(data,choice); % calculates the overall win percentage (seperate function)
cont()
end
if isempty(continueChoice)
fprintf("Thank you!") % exit the loop if another statistic is not wanted
break;
elseif continueChoice == 2
fprintf("Thank you!") % exit the loop if another statistic is not wanted
break;
end
This is what shows in the command window after selecting "exit" in the listdlg
continueChoice =
2
ans =
2
continueChoice is 2, so shouldnt it work? It just carries on with the rest of my code instead.
Please lmk if any more info is needed.
P.S the reason I’ve made a function which is so short is because one of the criteria for the project im doing is that it has to have a function which has an ouptut argument and this is the only thing I could make one for , I understand it’d be a lot easier just doing it in the main script. I have tried to use an ouptut argument to make a variable and use that variable in my main script, however when it is returning the value I want, it still isnt breaking the while loop?
Code for the function:
function continueChoice = cont()
continueChoice = listdlg("SelectionMode", "single", "ListString", ["Continue", "Exit"], "PromptString", "Would you like another statistic?")
end
Code in the main script:
data = readtable(‘alltimeteams.xlsx’,’VariableNamingRule’,’preserve’);
x = 0
while le(x,210)
x = x+1
choice=listdlg(‘SelectionMode’,’single’, ‘ListString’,data.Franchise,’PromptString’,’Please choose a franchise’); % all possible franchises
if isempty(choice)
fprintf("Please choose a franchise next time n")
break; % Exit the loop if no franchise is chosen
end
% the following is the problematic part
Wpercentchoice = listdlg("SelectionMode","single","PromptString","Would you like the win%?","ListString",["Yes","No"]);
if Wpercentchoice == 1
WinPercentcalc(data,choice); % calculates the overall win percentage (seperate function)
cont()
end
if isempty(continueChoice)
fprintf("Thank you!") % exit the loop if another statistic is not wanted
break;
elseif continueChoice == 2
fprintf("Thank you!") % exit the loop if another statistic is not wanted
break;
end
This is what shows in the command window after selecting "exit" in the listdlg
continueChoice =
2
ans =
2
continueChoice is 2, so shouldnt it work? It just carries on with the rest of my code instead.
Please lmk if any more info is needed.
P.S the reason I’ve made a function which is so short is because one of the criteria for the project im doing is that it has to have a function which has an ouptut argument and this is the only thing I could make one for , I understand it’d be a lot easier just doing it in the main script. function, output, if statement MATLAB Answers — New Questions









