Category: Matlab
Category Archives: Matlab
How to determe the Fatigue Damage according Miner’s Rule via rainflow counting
Dear Matlab Users,
I have difficulties calculating the total accumulated fatique damage for a set of data (see Attachements). I have determined the histogram based on Rainflow counting, and determined the line for the SN-curve (maximum allowable stress per cycle). The SN-curve has only one slope in this case.
To calculate the total accumulated fatique damage according Miner’s Rule, the number of cycles of the SN curve should be divided by the number of cycles of the histogram per stress range, and then be summed up.
My question is: How do I divide the values from the number of cycles of the SN-curve by the the values from the number of cycles of the histogram? How do I make the values of the same size? I want to divide the following (see script for clarification):
N=10.^(L_a1-m1*log(cigma_delta*(T/T_ref)^k)); with cigma_delta= [0:0.05:710]; % N-cycles SN-curve
by
C_7=histogram(‘BinEdges’,edges’,’BinCounts’,sum(hist,2), Orientation=’horizontal’) % Rainflow counting histogram
Thanks in advance!Dear Matlab Users,
I have difficulties calculating the total accumulated fatique damage for a set of data (see Attachements). I have determined the histogram based on Rainflow counting, and determined the line for the SN-curve (maximum allowable stress per cycle). The SN-curve has only one slope in this case.
To calculate the total accumulated fatique damage according Miner’s Rule, the number of cycles of the SN curve should be divided by the number of cycles of the histogram per stress range, and then be summed up.
My question is: How do I divide the values from the number of cycles of the SN-curve by the the values from the number of cycles of the histogram? How do I make the values of the same size? I want to divide the following (see script for clarification):
N=10.^(L_a1-m1*log(cigma_delta*(T/T_ref)^k)); with cigma_delta= [0:0.05:710]; % N-cycles SN-curve
by
C_7=histogram(‘BinEdges’,edges’,’BinCounts’,sum(hist,2), Orientation=’horizontal’) % Rainflow counting histogram
Thanks in advance! Dear Matlab Users,
I have difficulties calculating the total accumulated fatique damage for a set of data (see Attachements). I have determined the histogram based on Rainflow counting, and determined the line for the SN-curve (maximum allowable stress per cycle). The SN-curve has only one slope in this case.
To calculate the total accumulated fatique damage according Miner’s Rule, the number of cycles of the SN curve should be divided by the number of cycles of the histogram per stress range, and then be summed up.
My question is: How do I divide the values from the number of cycles of the SN-curve by the the values from the number of cycles of the histogram? How do I make the values of the same size? I want to divide the following (see script for clarification):
N=10.^(L_a1-m1*log(cigma_delta*(T/T_ref)^k)); with cigma_delta= [0:0.05:710]; % N-cycles SN-curve
by
C_7=histogram(‘BinEdges’,edges’,’BinCounts’,sum(hist,2), Orientation=’horizontal’) % Rainflow counting histogram
Thanks in advance! rainflow counting, miner’s rule, histogram, sn-curve, fatigue MATLAB Answers — New Questions
Parallel Processing is better than buying another MATLAB licence?
Hello,
I’m considering whether it’s more beneficial to purchase 2 or more MATLAB licenses or to invest in the Parallel Processing Toolbox. How many GPUs can we utilize with the Parallel Processing Toolbox, and is it worth the investment? I would greatly appreciate insights from someone with experience in this matter. Thank you!Hello,
I’m considering whether it’s more beneficial to purchase 2 or more MATLAB licenses or to invest in the Parallel Processing Toolbox. How many GPUs can we utilize with the Parallel Processing Toolbox, and is it worth the investment? I would greatly appreciate insights from someone with experience in this matter. Thank you! Hello,
I’m considering whether it’s more beneficial to purchase 2 or more MATLAB licenses or to invest in the Parallel Processing Toolbox. How many GPUs can we utilize with the Parallel Processing Toolbox, and is it worth the investment? I would greatly appreciate insights from someone with experience in this matter. Thank you! parallel computing toolbox, matlab MATLAB Answers — New Questions
importing CAD geometry over .STEP or .IGS Files
Hello dear Matlab Answer Members,
im looking for a way to import .STEP or/and .IGS Files into Matlab and be able to plot them at the end. I have already tried my luck with ‘IGES Toolbox’ but I am only getting error messages from that one. Do you guys know any better way to archive my goal or is the Toolbox I have already been using the one I want to get to work?
Thank you for your help in advance 🙂
FredericHello dear Matlab Answer Members,
im looking for a way to import .STEP or/and .IGS Files into Matlab and be able to plot them at the end. I have already tried my luck with ‘IGES Toolbox’ but I am only getting error messages from that one. Do you guys know any better way to archive my goal or is the Toolbox I have already been using the one I want to get to work?
Thank you for your help in advance 🙂
Frederic Hello dear Matlab Answer Members,
im looking for a way to import .STEP or/and .IGS Files into Matlab and be able to plot them at the end. I have already tried my luck with ‘IGES Toolbox’ but I am only getting error messages from that one. Do you guys know any better way to archive my goal or is the Toolbox I have already been using the one I want to get to work?
Thank you for your help in advance 🙂
Frederic step, iges, plot, iges toolbox, igs, cad, geometry MATLAB Answers — New Questions
Do we have option in Polyspace to generate report for Code Prover/ BugFinder in Excel or Spreadsheet format ?
I wanted to generate report for BugFinder and Code Prover in Excel format since the result generated from the analysis are too huge which causing Word format to hang or not responding most of the time.I wanted to generate report for BugFinder and Code Prover in Excel format since the result generated from the analysis are too huge which causing Word format to hang or not responding most of the time. I wanted to generate report for BugFinder and Code Prover in Excel format since the result generated from the analysis are too huge which causing Word format to hang or not responding most of the time. polyspace, bugfinder, codeprover, report MATLAB Answers — New Questions
Integro-differential equation solutions
I wanted to solve it for C, any suggestions to proceed with coding?I wanted to solve it for C, any suggestions to proceed with coding? I wanted to solve it for C, any suggestions to proceed with coding? how this type of equation can be solved in matlab? MATLAB Answers — New Questions
Curve Fitting for a Rational Polynomial Model.
Dear all,
I want to find the best rational Polynomial model that can fit the data shown.
any help would be appreciated.
Data are in dB.Dear all,
I want to find the best rational Polynomial model that can fit the data shown.
any help would be appreciated.
Data are in dB. Dear all,
I want to find the best rational Polynomial model that can fit the data shown.
any help would be appreciated.
Data are in dB. curve fitting MATLAB Answers — New Questions
Defining an improper function in Simulink
I want to implement this transfer function model related to viscous friction in simulink : Ms^2 + ws which means it does not have a denominator thus cannot be defined in simulink since it has a greater value of numerator than the denominator meaning it is an improper function, are there any workarounds that i can implements so that i can define this transfer function? Thank you very much.I want to implement this transfer function model related to viscous friction in simulink : Ms^2 + ws which means it does not have a denominator thus cannot be defined in simulink since it has a greater value of numerator than the denominator meaning it is an improper function, are there any workarounds that i can implements so that i can define this transfer function? Thank you very much. I want to implement this transfer function model related to viscous friction in simulink : Ms^2 + ws which means it does not have a denominator thus cannot be defined in simulink since it has a greater value of numerator than the denominator meaning it is an improper function, are there any workarounds that i can implements so that i can define this transfer function? Thank you very much. simulink, transfer function MATLAB Answers — New Questions
C code generation: memory allocation for reference model in multi-instance mode
I am generating c code for model reference hierarchy using Embedded Coder.
There are reference models which are called multiple times from a parent model.
In the generated code, the block signals and block states data for each instance of reference model is accumulated in block states data of parent model creating a large structure(which causes compilation error).
I would like to have a single memory allocation(global) for this reference model data and reuse it for all instances.
I tried changing many settings related to code generation/optimization, but could not fix this.
Is there any method to achieve this?
/* Block states (default storage) for model ‘ParentModel’ */
typedef struct {
MdlrefDW_ChildModel_T Instance1;
MdlrefDW_ChildModel_T Instance2;
MdlrefDW_ChildModel_T Instance3;
…
}DW_ParentModel_xxxx_T
ChildModel is having an image processing logic and MdlrefDW_ChildModel_T is having a size of 200MB.
So when the number of instances increases, size of final _DW structure increases significantly.I am generating c code for model reference hierarchy using Embedded Coder.
There are reference models which are called multiple times from a parent model.
In the generated code, the block signals and block states data for each instance of reference model is accumulated in block states data of parent model creating a large structure(which causes compilation error).
I would like to have a single memory allocation(global) for this reference model data and reuse it for all instances.
I tried changing many settings related to code generation/optimization, but could not fix this.
Is there any method to achieve this?
/* Block states (default storage) for model ‘ParentModel’ */
typedef struct {
MdlrefDW_ChildModel_T Instance1;
MdlrefDW_ChildModel_T Instance2;
MdlrefDW_ChildModel_T Instance3;
…
}DW_ParentModel_xxxx_T
ChildModel is having an image processing logic and MdlrefDW_ChildModel_T is having a size of 200MB.
So when the number of instances increases, size of final _DW structure increases significantly. I am generating c code for model reference hierarchy using Embedded Coder.
There are reference models which are called multiple times from a parent model.
In the generated code, the block signals and block states data for each instance of reference model is accumulated in block states data of parent model creating a large structure(which causes compilation error).
I would like to have a single memory allocation(global) for this reference model data and reuse it for all instances.
I tried changing many settings related to code generation/optimization, but could not fix this.
Is there any method to achieve this?
/* Block states (default storage) for model ‘ParentModel’ */
typedef struct {
MdlrefDW_ChildModel_T Instance1;
MdlrefDW_ChildModel_T Instance2;
MdlrefDW_ChildModel_T Instance3;
…
}DW_ParentModel_xxxx_T
ChildModel is having an image processing logic and MdlrefDW_ChildModel_T is having a size of 200MB.
So when the number of instances increases, size of final _DW structure increases significantly. simulink, code generation, reference models, multiinstance, global memory, heap, internal data buffer MATLAB Answers — New Questions
App Slow With UIAxes
Hi. I’m creating apps on app designer which use components such as sliders to control a plot. When plotting on a UIAxes, there is significant delay. However, when having the app plot on a separate figure, there is no delay. Does anyone know the reason for this and if there’s a way to plot on the UIAxes without the delay? Thanks.
I’m going to use an app modelling a cylinder removing a lot of the additional unnecessary stuff, so the type of problem is as clear as possible. The plot consists of surf, patch, and plot3. For all apps, the goal is not plotting data per say, but rather creating shapes, often in 3 dimensions. Therefore, the data is generally arrays of type double which don’t generally get over 100 elements.
I’m using MATLAB R2020a.
These are the two methods:
I drag and drop a UIAxes on to the app and plot on that axis. This takes about 3 seconds to update the plot each time I move the slider. This is a screenshot of the setup:
I create a separate regular figure (not uifigure) and plot it on that. This has almost no delay:
This is the code used to create the separate figure and have them aligned neatly (I don’t think it’s that important but it clarifies what I’m doing):
global ax %needed so it can be accessed through component callbacks
divide=.2;%the fraction of the screen filled by the app
set(0,’units’,’pixels’)
pixels=get(0,’screensize’);
app.UIFigure.Position=[0,0,divide*pixels(3),pixels(4)];
fig=figure; %new figure
fig.Position=[divide*pixels(3),0,(1-divide)*pixels(3),pixels(4)];
ax=axes(fig); %axis it will be plotted on
Here is the code which I used (I removed much of the code used in the original app to simplify things) (the code is based off of Clay M. Thompson’s cylinder function, and I kept the copyright text in the code):
function torsion(ax,ax2,M,G,L,r,display_in)
% Clay M. Thompson 4-24-91, CBM 8-21-92.
% Copyright 1984-2002 The MathWorks, Inc.
cla(ax)
% engineering equations:
J=1/4*r^4;
phi=M*L/(J*G);
% set up cylinder:
n = 50;
r = [r r]’;
r = r(:); % Make sure r is a vector.
m = length(r); if m==1, r = [r;r]; m = 2; end
theta = (0:n)/n*2*pi;
sintheta = sin(theta); sintheta(n+1) = 0;
x = r * cos(theta);
y = r * sintheta;
z = (0:m-1)’/(m-1) *L* ones(1,n+1);
hold(ax,’on’)
% plot cylinder
surf(ax,x,y,z,’EdgeColor’,’none’,’FaceAlpha’,1)
patch(ax,x(1,:),y(1,:),z(1,:),[.25 0 .7])
patch(ax,x(1,:),y(1,:),z(2,:),[.25 0 .7])
%plot helices
z_vals=linspace(0,L,n*L/(2*pi*r(1)));
for i=0:n-1
angle0=i*(2*pi)/n;
anglef=angle0+phi;
theta_part=linspace(angle0,anglef,length(z_vals));
x_part=(r*1.01)*cos(theta_part);
y_part=(r*1.01)*sin(theta_part);
z_vals=linspace(0,L,length(x_part));
plot3(ax,x_part,y_part,z_vals,’k’,’LineWidth’,.5)
end
% plot circles
for i=z_vals
plot3(ax,x,y,i*ones(1,n+1),’k’,’LineWidth’,.5)
end
endHi. I’m creating apps on app designer which use components such as sliders to control a plot. When plotting on a UIAxes, there is significant delay. However, when having the app plot on a separate figure, there is no delay. Does anyone know the reason for this and if there’s a way to plot on the UIAxes without the delay? Thanks.
I’m going to use an app modelling a cylinder removing a lot of the additional unnecessary stuff, so the type of problem is as clear as possible. The plot consists of surf, patch, and plot3. For all apps, the goal is not plotting data per say, but rather creating shapes, often in 3 dimensions. Therefore, the data is generally arrays of type double which don’t generally get over 100 elements.
I’m using MATLAB R2020a.
These are the two methods:
I drag and drop a UIAxes on to the app and plot on that axis. This takes about 3 seconds to update the plot each time I move the slider. This is a screenshot of the setup:
I create a separate regular figure (not uifigure) and plot it on that. This has almost no delay:
This is the code used to create the separate figure and have them aligned neatly (I don’t think it’s that important but it clarifies what I’m doing):
global ax %needed so it can be accessed through component callbacks
divide=.2;%the fraction of the screen filled by the app
set(0,’units’,’pixels’)
pixels=get(0,’screensize’);
app.UIFigure.Position=[0,0,divide*pixels(3),pixels(4)];
fig=figure; %new figure
fig.Position=[divide*pixels(3),0,(1-divide)*pixels(3),pixels(4)];
ax=axes(fig); %axis it will be plotted on
Here is the code which I used (I removed much of the code used in the original app to simplify things) (the code is based off of Clay M. Thompson’s cylinder function, and I kept the copyright text in the code):
function torsion(ax,ax2,M,G,L,r,display_in)
% Clay M. Thompson 4-24-91, CBM 8-21-92.
% Copyright 1984-2002 The MathWorks, Inc.
cla(ax)
% engineering equations:
J=1/4*r^4;
phi=M*L/(J*G);
% set up cylinder:
n = 50;
r = [r r]’;
r = r(:); % Make sure r is a vector.
m = length(r); if m==1, r = [r;r]; m = 2; end
theta = (0:n)/n*2*pi;
sintheta = sin(theta); sintheta(n+1) = 0;
x = r * cos(theta);
y = r * sintheta;
z = (0:m-1)’/(m-1) *L* ones(1,n+1);
hold(ax,’on’)
% plot cylinder
surf(ax,x,y,z,’EdgeColor’,’none’,’FaceAlpha’,1)
patch(ax,x(1,:),y(1,:),z(1,:),[.25 0 .7])
patch(ax,x(1,:),y(1,:),z(2,:),[.25 0 .7])
%plot helices
z_vals=linspace(0,L,n*L/(2*pi*r(1)));
for i=0:n-1
angle0=i*(2*pi)/n;
anglef=angle0+phi;
theta_part=linspace(angle0,anglef,length(z_vals));
x_part=(r*1.01)*cos(theta_part);
y_part=(r*1.01)*sin(theta_part);
z_vals=linspace(0,L,length(x_part));
plot3(ax,x_part,y_part,z_vals,’k’,’LineWidth’,.5)
end
% plot circles
for i=z_vals
plot3(ax,x,y,i*ones(1,n+1),’k’,’LineWidth’,.5)
end
end Hi. I’m creating apps on app designer which use components such as sliders to control a plot. When plotting on a UIAxes, there is significant delay. However, when having the app plot on a separate figure, there is no delay. Does anyone know the reason for this and if there’s a way to plot on the UIAxes without the delay? Thanks.
I’m going to use an app modelling a cylinder removing a lot of the additional unnecessary stuff, so the type of problem is as clear as possible. The plot consists of surf, patch, and plot3. For all apps, the goal is not plotting data per say, but rather creating shapes, often in 3 dimensions. Therefore, the data is generally arrays of type double which don’t generally get over 100 elements.
I’m using MATLAB R2020a.
These are the two methods:
I drag and drop a UIAxes on to the app and plot on that axis. This takes about 3 seconds to update the plot each time I move the slider. This is a screenshot of the setup:
I create a separate regular figure (not uifigure) and plot it on that. This has almost no delay:
This is the code used to create the separate figure and have them aligned neatly (I don’t think it’s that important but it clarifies what I’m doing):
global ax %needed so it can be accessed through component callbacks
divide=.2;%the fraction of the screen filled by the app
set(0,’units’,’pixels’)
pixels=get(0,’screensize’);
app.UIFigure.Position=[0,0,divide*pixels(3),pixels(4)];
fig=figure; %new figure
fig.Position=[divide*pixels(3),0,(1-divide)*pixels(3),pixels(4)];
ax=axes(fig); %axis it will be plotted on
Here is the code which I used (I removed much of the code used in the original app to simplify things) (the code is based off of Clay M. Thompson’s cylinder function, and I kept the copyright text in the code):
function torsion(ax,ax2,M,G,L,r,display_in)
% Clay M. Thompson 4-24-91, CBM 8-21-92.
% Copyright 1984-2002 The MathWorks, Inc.
cla(ax)
% engineering equations:
J=1/4*r^4;
phi=M*L/(J*G);
% set up cylinder:
n = 50;
r = [r r]’;
r = r(:); % Make sure r is a vector.
m = length(r); if m==1, r = [r;r]; m = 2; end
theta = (0:n)/n*2*pi;
sintheta = sin(theta); sintheta(n+1) = 0;
x = r * cos(theta);
y = r * sintheta;
z = (0:m-1)’/(m-1) *L* ones(1,n+1);
hold(ax,’on’)
% plot cylinder
surf(ax,x,y,z,’EdgeColor’,’none’,’FaceAlpha’,1)
patch(ax,x(1,:),y(1,:),z(1,:),[.25 0 .7])
patch(ax,x(1,:),y(1,:),z(2,:),[.25 0 .7])
%plot helices
z_vals=linspace(0,L,n*L/(2*pi*r(1)));
for i=0:n-1
angle0=i*(2*pi)/n;
anglef=angle0+phi;
theta_part=linspace(angle0,anglef,length(z_vals));
x_part=(r*1.01)*cos(theta_part);
y_part=(r*1.01)*sin(theta_part);
z_vals=linspace(0,L,length(x_part));
plot3(ax,x_part,y_part,z_vals,’k’,’LineWidth’,.5)
end
% plot circles
for i=z_vals
plot3(ax,x,y,i*ones(1,n+1),’k’,’LineWidth’,.5)
end
end app designer, plot, axes, delay MATLAB Answers — New Questions
DIVIDING A SIGNAL INTO SHORTER SEGMENTS AND SAVING THEM
Hello, I have a signal of 30 minutes duration. It is a csv file. I want to divide it into non overlapping segments of 10 sec duration and save them as different recordings. The sampling frequency of the signal is 360 Hz. How can I achieve this in matlab?Hello, I have a signal of 30 minutes duration. It is a csv file. I want to divide it into non overlapping segments of 10 sec duration and save them as different recordings. The sampling frequency of the signal is 360 Hz. How can I achieve this in matlab? Hello, I have a signal of 30 minutes duration. It is a csv file. I want to divide it into non overlapping segments of 10 sec duration and save them as different recordings. The sampling frequency of the signal is 360 Hz. How can I achieve this in matlab? signal manipulation, signal processing, segmentation MATLAB Answers — New Questions
Issues connecting MATLAB to Turtlebot4
I am trying to connect MATLAB R2023b on Ubuntu 22.04 to my Turtlebot4 using:
rosinit("http://192.168.1.3:11311");
I have checked my ROS_MASTER_URI on both my PC and the RPi.
On my PC:
$ echo $ROS_MASTER_URI
http://localhost:11311
On my RPi:
$ echo $ROS_MASTER_URI
http://192.168.1.3:11311
When I tried to do rosinit, MATLAB outputs the error:
Cannot connect to ROS master at http://192.168.1.3:11311. Check the specified address or hostname.
Am I missing something here? Any help would be greatly appreciated!I am trying to connect MATLAB R2023b on Ubuntu 22.04 to my Turtlebot4 using:
rosinit("http://192.168.1.3:11311");
I have checked my ROS_MASTER_URI on both my PC and the RPi.
On my PC:
$ echo $ROS_MASTER_URI
http://localhost:11311
On my RPi:
$ echo $ROS_MASTER_URI
http://192.168.1.3:11311
When I tried to do rosinit, MATLAB outputs the error:
Cannot connect to ROS master at http://192.168.1.3:11311. Check the specified address or hostname.
Am I missing something here? Any help would be greatly appreciated! I am trying to connect MATLAB R2023b on Ubuntu 22.04 to my Turtlebot4 using:
rosinit("http://192.168.1.3:11311");
I have checked my ROS_MASTER_URI on both my PC and the RPi.
On my PC:
$ echo $ROS_MASTER_URI
http://localhost:11311
On my RPi:
$ echo $ROS_MASTER_URI
http://192.168.1.3:11311
When I tried to do rosinit, MATLAB outputs the error:
Cannot connect to ROS master at http://192.168.1.3:11311. Check the specified address or hostname.
Am I missing something here? Any help would be greatly appreciated! matlab, ros2, turtlebot4 MATLAB Answers — New Questions
How getting Atlas image from fMRI images.
Hello everyone,
I am currently working on medical images resting state fMRI from Dhcp( Developing Human Connectome Project) datasets and i need to get their Atlas images using fMRI. But whenever I am trying i could not implement or find a code MATLAB to do it, this is really a new thing for me i never work on it. Please Can anyone suugest me what can i do or from where can i start ? I really need help. Thanks in advance!Hello everyone,
I am currently working on medical images resting state fMRI from Dhcp( Developing Human Connectome Project) datasets and i need to get their Atlas images using fMRI. But whenever I am trying i could not implement or find a code MATLAB to do it, this is really a new thing for me i never work on it. Please Can anyone suugest me what can i do or from where can i start ? I really need help. Thanks in advance! Hello everyone,
I am currently working on medical images resting state fMRI from Dhcp( Developing Human Connectome Project) datasets and i need to get their Atlas images using fMRI. But whenever I am trying i could not implement or find a code MATLAB to do it, this is really a new thing for me i never work on it. Please Can anyone suugest me what can i do or from where can i start ? I really need help. Thanks in advance! atlas images, fmri MATLAB Answers — New Questions
how to display a grayscale image in a monochrome color (other than white)
I have a grayscale image consisting of a matrix of 512×512 int16 numbers. If I run
figure;imshow(imagedata,[])
I can see my contrast adjusted image. Now all I want to do is to display this image by replacing white with green. I do not want to change the datatype to double or do something that would mess with the original data.
My first thought was to just look at the colormap and ideally that should look like
[0 0 0]
[1 1 1]
….
[255 255 255]
I thought I could just change that to be
[0 0 0]
[0 1 0]
…..
[0 255 0]
but when I take a look at the colormap of this grayscale image,
map = colormap;
the colormap has non-zero numbers (which are not equal to each other) in each of the r,g and b columns and so I don’t understand this. The grayscale colormap is supposed to have the same numbers in the r,g and b columns.
All I want to do is to tell matlab that the highest number maps to green instead of white. What is the easiest way of doing this?I have a grayscale image consisting of a matrix of 512×512 int16 numbers. If I run
figure;imshow(imagedata,[])
I can see my contrast adjusted image. Now all I want to do is to display this image by replacing white with green. I do not want to change the datatype to double or do something that would mess with the original data.
My first thought was to just look at the colormap and ideally that should look like
[0 0 0]
[1 1 1]
….
[255 255 255]
I thought I could just change that to be
[0 0 0]
[0 1 0]
…..
[0 255 0]
but when I take a look at the colormap of this grayscale image,
map = colormap;
the colormap has non-zero numbers (which are not equal to each other) in each of the r,g and b columns and so I don’t understand this. The grayscale colormap is supposed to have the same numbers in the r,g and b columns.
All I want to do is to tell matlab that the highest number maps to green instead of white. What is the easiest way of doing this? I have a grayscale image consisting of a matrix of 512×512 int16 numbers. If I run
figure;imshow(imagedata,[])
I can see my contrast adjusted image. Now all I want to do is to display this image by replacing white with green. I do not want to change the datatype to double or do something that would mess with the original data.
My first thought was to just look at the colormap and ideally that should look like
[0 0 0]
[1 1 1]
….
[255 255 255]
I thought I could just change that to be
[0 0 0]
[0 1 0]
…..
[0 255 0]
but when I take a look at the colormap of this grayscale image,
map = colormap;
the colormap has non-zero numbers (which are not equal to each other) in each of the r,g and b columns and so I don’t understand this. The grayscale colormap is supposed to have the same numbers in the r,g and b columns.
All I want to do is to tell matlab that the highest number maps to green instead of white. What is the easiest way of doing this? image processing, colormap MATLAB Answers — New Questions
solving system of equations
Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
endTried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end ode MATLAB Answers — New Questions
solving system of equations
Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
endTried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end ode MATLAB Answers — New Questions
solving system of equations
Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
endTried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end ode MATLAB Answers — New Questions
solving system of equations
Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
endTried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end Tried to get this to work but have had no luck.
Main Code:
syms x K M c1 c2 c3 c4
x0 = [0,0,0,0];
y0 = [1,200,-80,900];
coeff = [1,-0.02,12.5,-0.058,27.77];
rx = -0.05*exp(0.005*x)*cos(11.7*x) + 0.07*exp(0.005*x)*sin(11.7*x);
y_new = Examprac(x0,y0,coeff,rx);
Function:
function y = Examprac(x0,y0,coeff,rx)
syms x c1 c2 c3 c4 K M
yp = 2*K*cos((117*x)/10)*exp(x/200) + 2*M*sin((117*x)/10)*exp(x/200);
yp_der1 = diff(yp);
yp_der2 = diff(yp_der1);
yp_der3 = diff(yp_der2);
yp_der4 = diff(yp_der3);
yp_der1= simplify(yp_der1);
yp_der2= simplify(yp_der2);
yp_der3= simplify(yp_der3);
yp_der4= simplify(yp_der4);
g = simplify(coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx)
g = coeff(1)*yp_der4 + coeff(2)*yp_der3 + coeff(3)*yp_der2 + coeff(4)*yp_der1 + coeff(5)*yp == rx
C = solve(g, [M, K])
end ode MATLAB Answers — New Questions
how to display a grayscale image in a monochrome color (other than white)
I have a grayscale image consisting of a matrix of 512×512 int16 numbers. If I run
figure;imshow(imagedata,[])
I can see my contrast adjusted image. Now all I want to do is to display this image by replacing white with green. I do not want to change the datatype to double or do something that would mess with the original data.
My first thought was to just look at the colormap and ideally that should look like
[0 0 0]
[1 1 1]
….
[255 255 255]
I thought I could just change that to be
[0 0 0]
[0 1 0]
…..
[0 255 0]
but when I take a look at the colormap of this grayscale image,
map = colormap;
the colormap has non-zero numbers (which are not equal to each other) in each of the r,g and b columns and so I don’t understand this. The grayscale colormap is supposed to have the same numbers in the r,g and b columns.
All I want to do is to tell matlab that the highest number maps to green instead of white. What is the easiest way of doing this?I have a grayscale image consisting of a matrix of 512×512 int16 numbers. If I run
figure;imshow(imagedata,[])
I can see my contrast adjusted image. Now all I want to do is to display this image by replacing white with green. I do not want to change the datatype to double or do something that would mess with the original data.
My first thought was to just look at the colormap and ideally that should look like
[0 0 0]
[1 1 1]
….
[255 255 255]
I thought I could just change that to be
[0 0 0]
[0 1 0]
…..
[0 255 0]
but when I take a look at the colormap of this grayscale image,
map = colormap;
the colormap has non-zero numbers (which are not equal to each other) in each of the r,g and b columns and so I don’t understand this. The grayscale colormap is supposed to have the same numbers in the r,g and b columns.
All I want to do is to tell matlab that the highest number maps to green instead of white. What is the easiest way of doing this? I have a grayscale image consisting of a matrix of 512×512 int16 numbers. If I run
figure;imshow(imagedata,[])
I can see my contrast adjusted image. Now all I want to do is to display this image by replacing white with green. I do not want to change the datatype to double or do something that would mess with the original data.
My first thought was to just look at the colormap and ideally that should look like
[0 0 0]
[1 1 1]
….
[255 255 255]
I thought I could just change that to be
[0 0 0]
[0 1 0]
…..
[0 255 0]
but when I take a look at the colormap of this grayscale image,
map = colormap;
the colormap has non-zero numbers (which are not equal to each other) in each of the r,g and b columns and so I don’t understand this. The grayscale colormap is supposed to have the same numbers in the r,g and b columns.
All I want to do is to tell matlab that the highest number maps to green instead of white. What is the easiest way of doing this? image processing, colormap MATLAB Answers — New Questions
How to visualize histogram
num_simulations = 10000;
%Common parameters
Discount_Rate_min = 0.06; % assume 6-8%
Discount_Rate_max = 0.08;
Discount_Rate_values = unifrnd(Discount_Rate_min, Discount_Rate_max, [num_simulations, 1]);
Lifetime = 20; % years
Electricity_Cost_values = 0.185; %EUR/kWh
FLH = [4000,6000,8000];
LHV = 33.33; %kWh/kgH2
%SOEC 2020 parameters
CAPEX_System_SOEC_mean_2020 = 4200; %$/kW
CAPEX_System_SOEC_std_2020 = 50;
CAPEX_System_SOEC_values_2020 = normrnd(CAPEX_System_SOEC_mean_2020, CAPEX_System_SOEC_std_2020, [num_simulations,1]);
CAPEX_System_SOEC_values_2020(CAPEX_System_SOEC_values_2020 < 2800) = 2800;
CAPEX_System_SOEC_values_2020(CAPEX_System_SOEC_values_2020 > 5600) = 5600;
CAPEX_Stack_SOEC_values_2020 = 0.5*CAPEX_System_SOEC_values_2020; % 50% of CAPEX system
CAPEX_SOEC_values_2020 = (CAPEX_System_SOEC_values_2020 + CAPEX_Stack_SOEC_values_2020);
OPEX_SOEC_values_2020 = 3; % 3% of CAPEX/a
System_Efficiency_SOEC_mean_2020 = 0.775;
System_Efficiency_SOEC_std_2020 = 0.01;
System_Efficiency_SOEC_values_2020 = normrnd(System_Efficiency_SOEC_mean_2020, System_Efficiency_SOEC_std_2020, [num_simulations,1]);
System_Efficiency_SOEC_values_2020(System_Efficiency_SOEC_values_2020 < 0.74) = 0.74;
System_Efficiency_SOEC_values_2020(System_Efficiency_SOEC_values_2020 > 0.81) = 0.81;
%SOEC 2030 parameters
CAPEX_System_SOEC_mean_2030 = 1800; %$/kW
CAPEX_System_SOEC_std_2030 = 50;
CAPEX_System_SOEC_values_2030 = normrnd(CAPEX_System_SOEC_mean_2030, CAPEX_System_SOEC_std_2030, [num_simulations,1]);
CAPEX_System_SOEC_values_2030(CAPEX_System_SOEC_values_2030 < 2800) = 800;
CAPEX_System_SOEC_values_2030(CAPEX_System_SOEC_values_2030 > 5600) = 2800;
CAPEX_Stack_SOEC_values_2030 = 0.5*CAPEX_System_SOEC_values_2030; % 50% of CAPEX system
CAPEX_SOEC_values_2030 = (CAPEX_System_SOEC_values_2030 + CAPEX_Stack_SOEC_values_2030);
OPEX_SOEC_values_2030 = 3; % 3% of CAPEX/a
System_Efficiency_SOEC_mean_2030 = 0.805;
System_Efficiency_SOEC_std_2030 = 0.01;
System_Efficiency_SOEC_values_2030 = normrnd(System_Efficiency_SOEC_mean_2030, System_Efficiency_SOEC_std_2030, [num_simulations,1]);
System_Efficiency_SOEC_values_2030(System_Efficiency_SOEC_values_2030 < 0.77) = 0.77;
System_Efficiency_SOEC_values_2030(System_Efficiency_SOEC_values_2030 > 0.84) = 0.84;
%PEM 2020 parameters
CAPEX_System_PEM_mean_2020 = 1450; %$/kW
CAPEX_System_PEM_std_2020 = 50;
CAPEX_System_PEM_values_2020 = normrnd(CAPEX_System_PEM_mean_2020, CAPEX_System_PEM_std_2020, [num_simulations,1]);
CAPEX_System_PEM_values_2020(CAPEX_System_PEM_values_2020 < 1100) = 1100;
CAPEX_System_PEM_values_2020(CAPEX_System_PEM_values_2020 > 1800) = 1800;
CAPEX_Stack_PEM_values_2020 = 0.35*CAPEX_System_PEM_values_2020; % 35% of CAPEX system
CAPEX_PEM_values_2020 = (CAPEX_System_PEM_values_2020 + CAPEX_Stack_PEM_values_2020);
OPEX_PEM_values_2020 = 3;
System_Efficiency_PEM_mean_2020 = 0.58;
System_Efficiency_PEM_std_2020 = 0.01;
System_Efficiency_PEM_values_2020 = normrnd(System_Efficiency_PEM_mean_2020, System_Efficiency_PEM_std_2020, [num_simulations,1]);
System_Efficiency_PEM_values_2020(System_Efficiency_PEM_values_2020 < 0.56) = 0.56;
System_Efficiency_PEM_values_2020(System_Efficiency_PEM_values_2020 > 0.6) = 0.6;
%PEM 2030 parameters
CAPEX_System_PEM_mean_2030 = 1075; %$/kW
CAPEX_System_PEM_std_2030 = 50;
CAPEX_System_PEM_values_2030 = normrnd(CAPEX_System_PEM_mean_2030, CAPEX_System_PEM_std_2030, [num_simulations,1]);
CAPEX_System_PEM_values_2030(CAPEX_System_PEM_values_2030 < 650) = 650;
CAPEX_System_PEM_values_2030(CAPEX_System_PEM_values_2030 > 1500) = 1500;
CAPEX_Stack_PEM_values_2030 = 0.35*CAPEX_System_PEM_values_2030; % 35% of CAPEX system
CAPEX_PEM_values_2030 = (CAPEX_System_PEM_values_2030 + CAPEX_Stack_PEM_values_2030);
OPEX_PEM_values_2030 = 3;
System_Efficiency_PEM_mean_2030 = 0.655;
System_Efficiency_PEM_std_2030 = 0.01;
System_Efficiency_PEM_values_2030 = normrnd(System_Efficiency_PEM_mean_2030, System_Efficiency_PEM_std_2030, [num_simulations,1]);
System_Efficiency_PEM_values_2030(System_Efficiency_PEM_values_2030 < 0.63) = 0.63;
System_Efficiency_PEM_values_2030(System_Efficiency_PEM_values_2030 > 0.68) = 0.68;
%AEC 2020 parameters
CAPEX_System_AEC_mean_2020 = 950; % $/kW
CAPEX_System_AEC_std_2020 = 50;
CAPEX_System_AEC_values_2020 = normrnd(CAPEX_System_AEC_mean_2020, CAPEX_System_AEC_std_2020, [num_simulations,1]);
CAPEX_System_AEC_values_2020(CAPEX_System_AEC_values_2020 < 500) = 500;
CAPEX_System_AEC_values_2020(CAPEX_System_AEC_values_2020 > 1400) = 1400;
CAPEX_Stack_AEC_values_2020 = 0.35*CAPEX_System_AEC_values_2020; % 35% of CAPEX system
CAPEX_AEC_values_2020 = (CAPEX_System_AEC_values_2020 + CAPEX_Stack_AEC_values_2020);
OPEX_AEC_values_2020 = 3;
System_Efficiency_AEC_mean_2020 = 0.665;
System_Efficiency_AEC_std_2020 = 0.01;
System_Efficiency_AEC_values_2020 = normrnd(System_Efficiency_AEC_mean_2020, System_Efficiency_AEC_std_2020, [num_simulations,1]);
System_Efficiency_AEC_values_2020(System_Efficiency_AEC_values_2020 < 0.63) = 0.63;
System_Efficiency_AEC_values_2020(System_Efficiency_AEC_values_2020 > 0.7) = 0.7;
%AEC 2030 parameters
CAPEX_System_AEC_mean_2030 = 625; % $/kW
CAPEX_System_AEC_std_2030 = 50;
CAPEX_System_AEC_values_2030 = normrnd(CAPEX_System_AEC_mean_2030, CAPEX_System_AEC_std_2030, [num_simulations,1]);
CAPEX_System_AEC_values_2030(CAPEX_System_AEC_values_2030 < 400) = 400;
CAPEX_System_AEC_values_2030(CAPEX_System_AEC_values_2030 > 850) = 850;
CAPEX_Stack_AEC_values_2030 = 0.35*CAPEX_System_AEC_values_2030; % 35% of CAPEX system
CAPEX_AEC_values_2030 = (CAPEX_System_AEC_values_2030 + CAPEX_Stack_AEC_values_2030);
OPEX_AEC_values_2030 = 3;
System_Efficiency_AEC_mean_2030 = 0.68;
System_Efficiency_AEC_std_2030 = 0.01;
System_Efficiency_AEC_values_2030 = normrnd(System_Efficiency_AEC_mean_2030, System_Efficiency_AEC_std_2030, [num_simulations,1]);
System_Efficiency_AEC_values_2030(System_Efficiency_AEC_values_2030 < 0.65) = 0.65;
System_Efficiency_AEC_values_2030(System_Efficiency_AEC_values_2030 > 0.71) = 0.71;
% Calculate 2020 SOEC LCOH values
term1_S_2020 = LHV ./ (System_Efficiency_SOEC_values_2020);
term2_S_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_S_2020 = (OPEX_SOEC_values_2020 / 100);
term4_S_2020 = CAPEX_SOEC_values_2020 ./ FLH;
LCOH_SOEC_2020 = term1_S_2020 .* ((term2_S_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_S_2020) .* term4_S_2020 + Electricity_Cost_values);
% Calculate 2020 PEM LCOH values
term1_P_2020 = LHV ./ (System_Efficiency_PEM_values_2020);
term2_P_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_P_2020 = (OPEX_PEM_values_2020 / 100);
term4_P_2020 = CAPEX_PEM_values_2020 ./ FLH;
LCOH_PEM_2020 = term1_P_2020 .* ((term2_P_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_P_2020) .* term4_P_2020 + Electricity_Cost_values);
% Calculate 2020 AEC LCOH values
term1_A_2020 = LHV ./ (System_Efficiency_AEC_values_2020);
term2_A_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_A_2020 = (OPEX_AEC_values_2020 / 100);
term4_A_2020 = CAPEX_AEC_values_2020 ./ FLH;
LCOH_AEC_2020 = term1_A_2020 .* ((term2_A_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_A_2020) .* term4_A_2020 + Electricity_Cost_values);
% Calculate 2030 SOEC LCOH values
term1_S_2030 = LHV ./ (System_Efficiency_SOEC_values_2030);
term2_S_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_S_2030 = (OPEX_SOEC_values_2030 / 100);
term4_S_2030 = CAPEX_SOEC_values_2030 ./ FLH;
LCOH_SOEC_2030 = term1_S_2030 .* ((term2_S_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_S_2030) .* term4_S_2030 + Electricity_Cost_values);
% Calculate 2030 PEM LCOH values
term1_P_2030 = LHV ./ (System_Efficiency_PEM_values_2030);
term2_P_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_P_2030 = (OPEX_PEM_values_2030 / 100);
term4_P_2030 = CAPEX_PEM_values_2030 ./ FLH;
LCOH_PEM_2030 = term1_P_2030 .* ((term2_P_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_P_2030) .* term4_P_2030 + Electricity_Cost_values);
% Calculate 2030 AEC LCOH values
term1_A_2030 = LHV ./ (System_Efficiency_AEC_values_2030);
term2_A_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_A_2030 = (OPEX_AEC_values_2030 / 100);
term4_A_2030 = CAPEX_AEC_values_2030 ./ FLH;
LCOH_AEC_2030 = term1_A_2030 .* ((term2_A_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_A_2030) .* term4_A_2030 + Electricity_Cost_values);
Using the code data, I would like to compare LCOH of six items with histogram.
Image is like the picture.
What is command for it?num_simulations = 10000;
%Common parameters
Discount_Rate_min = 0.06; % assume 6-8%
Discount_Rate_max = 0.08;
Discount_Rate_values = unifrnd(Discount_Rate_min, Discount_Rate_max, [num_simulations, 1]);
Lifetime = 20; % years
Electricity_Cost_values = 0.185; %EUR/kWh
FLH = [4000,6000,8000];
LHV = 33.33; %kWh/kgH2
%SOEC 2020 parameters
CAPEX_System_SOEC_mean_2020 = 4200; %$/kW
CAPEX_System_SOEC_std_2020 = 50;
CAPEX_System_SOEC_values_2020 = normrnd(CAPEX_System_SOEC_mean_2020, CAPEX_System_SOEC_std_2020, [num_simulations,1]);
CAPEX_System_SOEC_values_2020(CAPEX_System_SOEC_values_2020 < 2800) = 2800;
CAPEX_System_SOEC_values_2020(CAPEX_System_SOEC_values_2020 > 5600) = 5600;
CAPEX_Stack_SOEC_values_2020 = 0.5*CAPEX_System_SOEC_values_2020; % 50% of CAPEX system
CAPEX_SOEC_values_2020 = (CAPEX_System_SOEC_values_2020 + CAPEX_Stack_SOEC_values_2020);
OPEX_SOEC_values_2020 = 3; % 3% of CAPEX/a
System_Efficiency_SOEC_mean_2020 = 0.775;
System_Efficiency_SOEC_std_2020 = 0.01;
System_Efficiency_SOEC_values_2020 = normrnd(System_Efficiency_SOEC_mean_2020, System_Efficiency_SOEC_std_2020, [num_simulations,1]);
System_Efficiency_SOEC_values_2020(System_Efficiency_SOEC_values_2020 < 0.74) = 0.74;
System_Efficiency_SOEC_values_2020(System_Efficiency_SOEC_values_2020 > 0.81) = 0.81;
%SOEC 2030 parameters
CAPEX_System_SOEC_mean_2030 = 1800; %$/kW
CAPEX_System_SOEC_std_2030 = 50;
CAPEX_System_SOEC_values_2030 = normrnd(CAPEX_System_SOEC_mean_2030, CAPEX_System_SOEC_std_2030, [num_simulations,1]);
CAPEX_System_SOEC_values_2030(CAPEX_System_SOEC_values_2030 < 2800) = 800;
CAPEX_System_SOEC_values_2030(CAPEX_System_SOEC_values_2030 > 5600) = 2800;
CAPEX_Stack_SOEC_values_2030 = 0.5*CAPEX_System_SOEC_values_2030; % 50% of CAPEX system
CAPEX_SOEC_values_2030 = (CAPEX_System_SOEC_values_2030 + CAPEX_Stack_SOEC_values_2030);
OPEX_SOEC_values_2030 = 3; % 3% of CAPEX/a
System_Efficiency_SOEC_mean_2030 = 0.805;
System_Efficiency_SOEC_std_2030 = 0.01;
System_Efficiency_SOEC_values_2030 = normrnd(System_Efficiency_SOEC_mean_2030, System_Efficiency_SOEC_std_2030, [num_simulations,1]);
System_Efficiency_SOEC_values_2030(System_Efficiency_SOEC_values_2030 < 0.77) = 0.77;
System_Efficiency_SOEC_values_2030(System_Efficiency_SOEC_values_2030 > 0.84) = 0.84;
%PEM 2020 parameters
CAPEX_System_PEM_mean_2020 = 1450; %$/kW
CAPEX_System_PEM_std_2020 = 50;
CAPEX_System_PEM_values_2020 = normrnd(CAPEX_System_PEM_mean_2020, CAPEX_System_PEM_std_2020, [num_simulations,1]);
CAPEX_System_PEM_values_2020(CAPEX_System_PEM_values_2020 < 1100) = 1100;
CAPEX_System_PEM_values_2020(CAPEX_System_PEM_values_2020 > 1800) = 1800;
CAPEX_Stack_PEM_values_2020 = 0.35*CAPEX_System_PEM_values_2020; % 35% of CAPEX system
CAPEX_PEM_values_2020 = (CAPEX_System_PEM_values_2020 + CAPEX_Stack_PEM_values_2020);
OPEX_PEM_values_2020 = 3;
System_Efficiency_PEM_mean_2020 = 0.58;
System_Efficiency_PEM_std_2020 = 0.01;
System_Efficiency_PEM_values_2020 = normrnd(System_Efficiency_PEM_mean_2020, System_Efficiency_PEM_std_2020, [num_simulations,1]);
System_Efficiency_PEM_values_2020(System_Efficiency_PEM_values_2020 < 0.56) = 0.56;
System_Efficiency_PEM_values_2020(System_Efficiency_PEM_values_2020 > 0.6) = 0.6;
%PEM 2030 parameters
CAPEX_System_PEM_mean_2030 = 1075; %$/kW
CAPEX_System_PEM_std_2030 = 50;
CAPEX_System_PEM_values_2030 = normrnd(CAPEX_System_PEM_mean_2030, CAPEX_System_PEM_std_2030, [num_simulations,1]);
CAPEX_System_PEM_values_2030(CAPEX_System_PEM_values_2030 < 650) = 650;
CAPEX_System_PEM_values_2030(CAPEX_System_PEM_values_2030 > 1500) = 1500;
CAPEX_Stack_PEM_values_2030 = 0.35*CAPEX_System_PEM_values_2030; % 35% of CAPEX system
CAPEX_PEM_values_2030 = (CAPEX_System_PEM_values_2030 + CAPEX_Stack_PEM_values_2030);
OPEX_PEM_values_2030 = 3;
System_Efficiency_PEM_mean_2030 = 0.655;
System_Efficiency_PEM_std_2030 = 0.01;
System_Efficiency_PEM_values_2030 = normrnd(System_Efficiency_PEM_mean_2030, System_Efficiency_PEM_std_2030, [num_simulations,1]);
System_Efficiency_PEM_values_2030(System_Efficiency_PEM_values_2030 < 0.63) = 0.63;
System_Efficiency_PEM_values_2030(System_Efficiency_PEM_values_2030 > 0.68) = 0.68;
%AEC 2020 parameters
CAPEX_System_AEC_mean_2020 = 950; % $/kW
CAPEX_System_AEC_std_2020 = 50;
CAPEX_System_AEC_values_2020 = normrnd(CAPEX_System_AEC_mean_2020, CAPEX_System_AEC_std_2020, [num_simulations,1]);
CAPEX_System_AEC_values_2020(CAPEX_System_AEC_values_2020 < 500) = 500;
CAPEX_System_AEC_values_2020(CAPEX_System_AEC_values_2020 > 1400) = 1400;
CAPEX_Stack_AEC_values_2020 = 0.35*CAPEX_System_AEC_values_2020; % 35% of CAPEX system
CAPEX_AEC_values_2020 = (CAPEX_System_AEC_values_2020 + CAPEX_Stack_AEC_values_2020);
OPEX_AEC_values_2020 = 3;
System_Efficiency_AEC_mean_2020 = 0.665;
System_Efficiency_AEC_std_2020 = 0.01;
System_Efficiency_AEC_values_2020 = normrnd(System_Efficiency_AEC_mean_2020, System_Efficiency_AEC_std_2020, [num_simulations,1]);
System_Efficiency_AEC_values_2020(System_Efficiency_AEC_values_2020 < 0.63) = 0.63;
System_Efficiency_AEC_values_2020(System_Efficiency_AEC_values_2020 > 0.7) = 0.7;
%AEC 2030 parameters
CAPEX_System_AEC_mean_2030 = 625; % $/kW
CAPEX_System_AEC_std_2030 = 50;
CAPEX_System_AEC_values_2030 = normrnd(CAPEX_System_AEC_mean_2030, CAPEX_System_AEC_std_2030, [num_simulations,1]);
CAPEX_System_AEC_values_2030(CAPEX_System_AEC_values_2030 < 400) = 400;
CAPEX_System_AEC_values_2030(CAPEX_System_AEC_values_2030 > 850) = 850;
CAPEX_Stack_AEC_values_2030 = 0.35*CAPEX_System_AEC_values_2030; % 35% of CAPEX system
CAPEX_AEC_values_2030 = (CAPEX_System_AEC_values_2030 + CAPEX_Stack_AEC_values_2030);
OPEX_AEC_values_2030 = 3;
System_Efficiency_AEC_mean_2030 = 0.68;
System_Efficiency_AEC_std_2030 = 0.01;
System_Efficiency_AEC_values_2030 = normrnd(System_Efficiency_AEC_mean_2030, System_Efficiency_AEC_std_2030, [num_simulations,1]);
System_Efficiency_AEC_values_2030(System_Efficiency_AEC_values_2030 < 0.65) = 0.65;
System_Efficiency_AEC_values_2030(System_Efficiency_AEC_values_2030 > 0.71) = 0.71;
% Calculate 2020 SOEC LCOH values
term1_S_2020 = LHV ./ (System_Efficiency_SOEC_values_2020);
term2_S_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_S_2020 = (OPEX_SOEC_values_2020 / 100);
term4_S_2020 = CAPEX_SOEC_values_2020 ./ FLH;
LCOH_SOEC_2020 = term1_S_2020 .* ((term2_S_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_S_2020) .* term4_S_2020 + Electricity_Cost_values);
% Calculate 2020 PEM LCOH values
term1_P_2020 = LHV ./ (System_Efficiency_PEM_values_2020);
term2_P_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_P_2020 = (OPEX_PEM_values_2020 / 100);
term4_P_2020 = CAPEX_PEM_values_2020 ./ FLH;
LCOH_PEM_2020 = term1_P_2020 .* ((term2_P_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_P_2020) .* term4_P_2020 + Electricity_Cost_values);
% Calculate 2020 AEC LCOH values
term1_A_2020 = LHV ./ (System_Efficiency_AEC_values_2020);
term2_A_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_A_2020 = (OPEX_AEC_values_2020 / 100);
term4_A_2020 = CAPEX_AEC_values_2020 ./ FLH;
LCOH_AEC_2020 = term1_A_2020 .* ((term2_A_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_A_2020) .* term4_A_2020 + Electricity_Cost_values);
% Calculate 2030 SOEC LCOH values
term1_S_2030 = LHV ./ (System_Efficiency_SOEC_values_2030);
term2_S_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_S_2030 = (OPEX_SOEC_values_2030 / 100);
term4_S_2030 = CAPEX_SOEC_values_2030 ./ FLH;
LCOH_SOEC_2030 = term1_S_2030 .* ((term2_S_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_S_2030) .* term4_S_2030 + Electricity_Cost_values);
% Calculate 2030 PEM LCOH values
term1_P_2030 = LHV ./ (System_Efficiency_PEM_values_2030);
term2_P_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_P_2030 = (OPEX_PEM_values_2030 / 100);
term4_P_2030 = CAPEX_PEM_values_2030 ./ FLH;
LCOH_PEM_2030 = term1_P_2030 .* ((term2_P_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_P_2030) .* term4_P_2030 + Electricity_Cost_values);
% Calculate 2030 AEC LCOH values
term1_A_2030 = LHV ./ (System_Efficiency_AEC_values_2030);
term2_A_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_A_2030 = (OPEX_AEC_values_2030 / 100);
term4_A_2030 = CAPEX_AEC_values_2030 ./ FLH;
LCOH_AEC_2030 = term1_A_2030 .* ((term2_A_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_A_2030) .* term4_A_2030 + Electricity_Cost_values);
Using the code data, I would like to compare LCOH of six items with histogram.
Image is like the picture.
What is command for it? num_simulations = 10000;
%Common parameters
Discount_Rate_min = 0.06; % assume 6-8%
Discount_Rate_max = 0.08;
Discount_Rate_values = unifrnd(Discount_Rate_min, Discount_Rate_max, [num_simulations, 1]);
Lifetime = 20; % years
Electricity_Cost_values = 0.185; %EUR/kWh
FLH = [4000,6000,8000];
LHV = 33.33; %kWh/kgH2
%SOEC 2020 parameters
CAPEX_System_SOEC_mean_2020 = 4200; %$/kW
CAPEX_System_SOEC_std_2020 = 50;
CAPEX_System_SOEC_values_2020 = normrnd(CAPEX_System_SOEC_mean_2020, CAPEX_System_SOEC_std_2020, [num_simulations,1]);
CAPEX_System_SOEC_values_2020(CAPEX_System_SOEC_values_2020 < 2800) = 2800;
CAPEX_System_SOEC_values_2020(CAPEX_System_SOEC_values_2020 > 5600) = 5600;
CAPEX_Stack_SOEC_values_2020 = 0.5*CAPEX_System_SOEC_values_2020; % 50% of CAPEX system
CAPEX_SOEC_values_2020 = (CAPEX_System_SOEC_values_2020 + CAPEX_Stack_SOEC_values_2020);
OPEX_SOEC_values_2020 = 3; % 3% of CAPEX/a
System_Efficiency_SOEC_mean_2020 = 0.775;
System_Efficiency_SOEC_std_2020 = 0.01;
System_Efficiency_SOEC_values_2020 = normrnd(System_Efficiency_SOEC_mean_2020, System_Efficiency_SOEC_std_2020, [num_simulations,1]);
System_Efficiency_SOEC_values_2020(System_Efficiency_SOEC_values_2020 < 0.74) = 0.74;
System_Efficiency_SOEC_values_2020(System_Efficiency_SOEC_values_2020 > 0.81) = 0.81;
%SOEC 2030 parameters
CAPEX_System_SOEC_mean_2030 = 1800; %$/kW
CAPEX_System_SOEC_std_2030 = 50;
CAPEX_System_SOEC_values_2030 = normrnd(CAPEX_System_SOEC_mean_2030, CAPEX_System_SOEC_std_2030, [num_simulations,1]);
CAPEX_System_SOEC_values_2030(CAPEX_System_SOEC_values_2030 < 2800) = 800;
CAPEX_System_SOEC_values_2030(CAPEX_System_SOEC_values_2030 > 5600) = 2800;
CAPEX_Stack_SOEC_values_2030 = 0.5*CAPEX_System_SOEC_values_2030; % 50% of CAPEX system
CAPEX_SOEC_values_2030 = (CAPEX_System_SOEC_values_2030 + CAPEX_Stack_SOEC_values_2030);
OPEX_SOEC_values_2030 = 3; % 3% of CAPEX/a
System_Efficiency_SOEC_mean_2030 = 0.805;
System_Efficiency_SOEC_std_2030 = 0.01;
System_Efficiency_SOEC_values_2030 = normrnd(System_Efficiency_SOEC_mean_2030, System_Efficiency_SOEC_std_2030, [num_simulations,1]);
System_Efficiency_SOEC_values_2030(System_Efficiency_SOEC_values_2030 < 0.77) = 0.77;
System_Efficiency_SOEC_values_2030(System_Efficiency_SOEC_values_2030 > 0.84) = 0.84;
%PEM 2020 parameters
CAPEX_System_PEM_mean_2020 = 1450; %$/kW
CAPEX_System_PEM_std_2020 = 50;
CAPEX_System_PEM_values_2020 = normrnd(CAPEX_System_PEM_mean_2020, CAPEX_System_PEM_std_2020, [num_simulations,1]);
CAPEX_System_PEM_values_2020(CAPEX_System_PEM_values_2020 < 1100) = 1100;
CAPEX_System_PEM_values_2020(CAPEX_System_PEM_values_2020 > 1800) = 1800;
CAPEX_Stack_PEM_values_2020 = 0.35*CAPEX_System_PEM_values_2020; % 35% of CAPEX system
CAPEX_PEM_values_2020 = (CAPEX_System_PEM_values_2020 + CAPEX_Stack_PEM_values_2020);
OPEX_PEM_values_2020 = 3;
System_Efficiency_PEM_mean_2020 = 0.58;
System_Efficiency_PEM_std_2020 = 0.01;
System_Efficiency_PEM_values_2020 = normrnd(System_Efficiency_PEM_mean_2020, System_Efficiency_PEM_std_2020, [num_simulations,1]);
System_Efficiency_PEM_values_2020(System_Efficiency_PEM_values_2020 < 0.56) = 0.56;
System_Efficiency_PEM_values_2020(System_Efficiency_PEM_values_2020 > 0.6) = 0.6;
%PEM 2030 parameters
CAPEX_System_PEM_mean_2030 = 1075; %$/kW
CAPEX_System_PEM_std_2030 = 50;
CAPEX_System_PEM_values_2030 = normrnd(CAPEX_System_PEM_mean_2030, CAPEX_System_PEM_std_2030, [num_simulations,1]);
CAPEX_System_PEM_values_2030(CAPEX_System_PEM_values_2030 < 650) = 650;
CAPEX_System_PEM_values_2030(CAPEX_System_PEM_values_2030 > 1500) = 1500;
CAPEX_Stack_PEM_values_2030 = 0.35*CAPEX_System_PEM_values_2030; % 35% of CAPEX system
CAPEX_PEM_values_2030 = (CAPEX_System_PEM_values_2030 + CAPEX_Stack_PEM_values_2030);
OPEX_PEM_values_2030 = 3;
System_Efficiency_PEM_mean_2030 = 0.655;
System_Efficiency_PEM_std_2030 = 0.01;
System_Efficiency_PEM_values_2030 = normrnd(System_Efficiency_PEM_mean_2030, System_Efficiency_PEM_std_2030, [num_simulations,1]);
System_Efficiency_PEM_values_2030(System_Efficiency_PEM_values_2030 < 0.63) = 0.63;
System_Efficiency_PEM_values_2030(System_Efficiency_PEM_values_2030 > 0.68) = 0.68;
%AEC 2020 parameters
CAPEX_System_AEC_mean_2020 = 950; % $/kW
CAPEX_System_AEC_std_2020 = 50;
CAPEX_System_AEC_values_2020 = normrnd(CAPEX_System_AEC_mean_2020, CAPEX_System_AEC_std_2020, [num_simulations,1]);
CAPEX_System_AEC_values_2020(CAPEX_System_AEC_values_2020 < 500) = 500;
CAPEX_System_AEC_values_2020(CAPEX_System_AEC_values_2020 > 1400) = 1400;
CAPEX_Stack_AEC_values_2020 = 0.35*CAPEX_System_AEC_values_2020; % 35% of CAPEX system
CAPEX_AEC_values_2020 = (CAPEX_System_AEC_values_2020 + CAPEX_Stack_AEC_values_2020);
OPEX_AEC_values_2020 = 3;
System_Efficiency_AEC_mean_2020 = 0.665;
System_Efficiency_AEC_std_2020 = 0.01;
System_Efficiency_AEC_values_2020 = normrnd(System_Efficiency_AEC_mean_2020, System_Efficiency_AEC_std_2020, [num_simulations,1]);
System_Efficiency_AEC_values_2020(System_Efficiency_AEC_values_2020 < 0.63) = 0.63;
System_Efficiency_AEC_values_2020(System_Efficiency_AEC_values_2020 > 0.7) = 0.7;
%AEC 2030 parameters
CAPEX_System_AEC_mean_2030 = 625; % $/kW
CAPEX_System_AEC_std_2030 = 50;
CAPEX_System_AEC_values_2030 = normrnd(CAPEX_System_AEC_mean_2030, CAPEX_System_AEC_std_2030, [num_simulations,1]);
CAPEX_System_AEC_values_2030(CAPEX_System_AEC_values_2030 < 400) = 400;
CAPEX_System_AEC_values_2030(CAPEX_System_AEC_values_2030 > 850) = 850;
CAPEX_Stack_AEC_values_2030 = 0.35*CAPEX_System_AEC_values_2030; % 35% of CAPEX system
CAPEX_AEC_values_2030 = (CAPEX_System_AEC_values_2030 + CAPEX_Stack_AEC_values_2030);
OPEX_AEC_values_2030 = 3;
System_Efficiency_AEC_mean_2030 = 0.68;
System_Efficiency_AEC_std_2030 = 0.01;
System_Efficiency_AEC_values_2030 = normrnd(System_Efficiency_AEC_mean_2030, System_Efficiency_AEC_std_2030, [num_simulations,1]);
System_Efficiency_AEC_values_2030(System_Efficiency_AEC_values_2030 < 0.65) = 0.65;
System_Efficiency_AEC_values_2030(System_Efficiency_AEC_values_2030 > 0.71) = 0.71;
% Calculate 2020 SOEC LCOH values
term1_S_2020 = LHV ./ (System_Efficiency_SOEC_values_2020);
term2_S_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_S_2020 = (OPEX_SOEC_values_2020 / 100);
term4_S_2020 = CAPEX_SOEC_values_2020 ./ FLH;
LCOH_SOEC_2020 = term1_S_2020 .* ((term2_S_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_S_2020) .* term4_S_2020 + Electricity_Cost_values);
% Calculate 2020 PEM LCOH values
term1_P_2020 = LHV ./ (System_Efficiency_PEM_values_2020);
term2_P_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_P_2020 = (OPEX_PEM_values_2020 / 100);
term4_P_2020 = CAPEX_PEM_values_2020 ./ FLH;
LCOH_PEM_2020 = term1_P_2020 .* ((term2_P_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_P_2020) .* term4_P_2020 + Electricity_Cost_values);
% Calculate 2020 AEC LCOH values
term1_A_2020 = LHV ./ (System_Efficiency_AEC_values_2020);
term2_A_2020 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_A_2020 = (OPEX_AEC_values_2020 / 100);
term4_A_2020 = CAPEX_AEC_values_2020 ./ FLH;
LCOH_AEC_2020 = term1_A_2020 .* ((term2_A_2020 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_A_2020) .* term4_A_2020 + Electricity_Cost_values);
% Calculate 2030 SOEC LCOH values
term1_S_2030 = LHV ./ (System_Efficiency_SOEC_values_2030);
term2_S_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_S_2030 = (OPEX_SOEC_values_2030 / 100);
term4_S_2030 = CAPEX_SOEC_values_2030 ./ FLH;
LCOH_SOEC_2030 = term1_S_2030 .* ((term2_S_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_S_2030) .* term4_S_2030 + Electricity_Cost_values);
% Calculate 2030 PEM LCOH values
term1_P_2030 = LHV ./ (System_Efficiency_PEM_values_2030);
term2_P_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_P_2030 = (OPEX_PEM_values_2030 / 100);
term4_P_2030 = CAPEX_PEM_values_2030 ./ FLH;
LCOH_PEM_2030 = term1_P_2030 .* ((term2_P_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_P_2030) .* term4_P_2030 + Electricity_Cost_values);
% Calculate 2030 AEC LCOH values
term1_A_2030 = LHV ./ (System_Efficiency_AEC_values_2030);
term2_A_2030 = Discount_Rate_values .* (1 + Discount_Rate_values).^Lifetime;
term3_A_2030 = (OPEX_AEC_values_2030 / 100);
term4_A_2030 = CAPEX_AEC_values_2030 ./ FLH;
LCOH_AEC_2030 = term1_A_2030 .* ((term2_A_2030 ./ ((1 + Discount_Rate_values).^Lifetime – 1) + term3_A_2030) .* term4_A_2030 + Electricity_Cost_values);
Using the code data, I would like to compare LCOH of six items with histogram.
Image is like the picture.
What is command for it? 30 MATLAB Answers — New Questions
It seems that data is not recorded
Hello, since this morning (around 8h00 am, Paris time), data sent by my iots is not recorded. I have not changed any settings on my iots and my internet connection is OK. On the page with my channels, it seems that the channels are updated because I see that the "updated" times are evolving. Is there a problem today with Thingspeak?Hello, since this morning (around 8h00 am, Paris time), data sent by my iots is not recorded. I have not changed any settings on my iots and my internet connection is OK. On the page with my channels, it seems that the channels are updated because I see that the "updated" times are evolving. Is there a problem today with Thingspeak? Hello, since this morning (around 8h00 am, Paris time), data sent by my iots is not recorded. I have not changed any settings on my iots and my internet connection is OK. On the page with my channels, it seems that the channels are updated because I see that the "updated" times are evolving. Is there a problem today with Thingspeak? thingspeak, service down MATLAB Answers — New Questions