SlideShare a Scribd company logo
1 of 7
Download to read offline
clear
clc
close all
%Use polyfit to solve for the phase lines
point11=[0,15];
point12=[0,300];
line1=polyfit(point11,point12,1);
m1=line1(1);
b1=line1(2);
xpf1=linspace(min(point11),max(point11),100);
ypf1=m1*xpf1+b1;
point21=[0,15];
point22=[700,300];
line2=polyfit(point21,point22,1);
m2=line2(1);
b2=line2(2);
xpf2=linspace(min(point21),max(point21),100);
ypf2=m2*xpf2+b2;
point31=[0,50];
point32=[700,300];
line3=polyfit(point31,point32,1);
m3=line3(1);
b3=line3(2);
xpf3=linspace(min(point31),max(point31),100);
ypf3=m3*xpf3+b3;
point41=[50,100];
point42=[300,800];
line4=polyfit(point41,point42,1);
m4=line4(1);
b4=line4(2);
xpf4=linspace(min(point41),max(point41),100);
ypf4=m4*xpf4+b4;
point51=[100,85];
point52=[800,300];
line5=polyfit(point51,point52,1);
m5=line5(1);
b5=line5(2);
xpf5=linspace(min(point51),max(point51),100);
ypf5=m5*xpf5+b5;
point61=[85,100];
point62=[300,0];
line6=polyfit(point61,point62,1);
m6=line6(1);
b6=line6(2);
xpf6=linspace(min(point61),max(point61),100);
ypf6=m6*xpf6+b6;
point71=[15,85];
point72=[300,300];
%Allow the user to set the percent of B
b=input('Enter the mass percent of B: ');
%Return an error if the percent of B is not a valid number
if b<0 || b>100
error('Please enter a value between 0 and 100.')
end
%Allow the user to set the temperature
t=input('Enter the temperature [deg C]: ');
%Solve for percent composition of A
a=100-b;
%Determine phase based on temperature and percent composition of B using
%the phase lines
if t<300
if b<15 && t>m1*b+b1
phase='alpha';
elseif b<15 && t=15 && b<=85
phase='alpha + beta';
elseif b>85 && t>m6*b+b6
phase='beta';
else phase='alpha + beta';
end
elseif b<15
if t=15 && b<=50
if t50 && b<=85
if t=15 && b<=85 && t==300
fprintf('The provided conditions fall on the eutectic line. ')
end
if b==50 && t==300
fprintf('The provided conditions fall on the eutectic point. ')
end
%Output a formatted statement to display the phase
fprintf('For the composition of %0.2f%% A, %0.2f%% B and a temperature of %0.0f degrees
Celsius, the phase is %s. ',a,b,t,phase)
%Create a plot of the phase lines and the user's set point
figure('color','white')
%Set axes
axis([0 100 0 1000])
%Plot the phase lines, eutectic line, eutectic point, and the user's point
plot(xpf1,ypf1,'-b')
hold on
plot(xpf2,ypf2,'-b')
plot(xpf3,ypf3,'-b')
plot(xpf4,ypf4,'-b')
plot(xpf5,ypf5,'-b')
plot(xpf6,ypf6,'-b')
plot(point71,point72,'-k')
plot(b,t,'ro','MarkerFaceColor','r')
%Assign a title and axes labels
title('Phase Diagram of Elements A and B')
xlabel('Percent Composition of B')
ylabel('Temperature (T) [deg C]')
%Set scaling for the axes
set(gca,'XTick',0:10:100,'YTick',0:100:1000)
%Place the phase names on the graph
text(40,200,'alpha+beta')
text(45,600,'Liquid')
text(90,300,'beta')
text(3,300,'alpha')
text(15,375,'alpha + Liquid')
text(62,375,'beta + Liquid')
Solution
clear
clc
close all
%Use polyfit to solve for the phase lines
point11=[0,15];
point12=[0,300];
line1=polyfit(point11,point12,1);
m1=line1(1);
b1=line1(2);
xpf1=linspace(min(point11),max(point11),100);
ypf1=m1*xpf1+b1;
point21=[0,15];
point22=[700,300];
line2=polyfit(point21,point22,1);
m2=line2(1);
b2=line2(2);
xpf2=linspace(min(point21),max(point21),100);
ypf2=m2*xpf2+b2;
point31=[0,50];
point32=[700,300];
line3=polyfit(point31,point32,1);
m3=line3(1);
b3=line3(2);
xpf3=linspace(min(point31),max(point31),100);
ypf3=m3*xpf3+b3;
point41=[50,100];
point42=[300,800];
line4=polyfit(point41,point42,1);
m4=line4(1);
b4=line4(2);
xpf4=linspace(min(point41),max(point41),100);
ypf4=m4*xpf4+b4;
point51=[100,85];
point52=[800,300];
line5=polyfit(point51,point52,1);
m5=line5(1);
b5=line5(2);
xpf5=linspace(min(point51),max(point51),100);
ypf5=m5*xpf5+b5;
point61=[85,100];
point62=[300,0];
line6=polyfit(point61,point62,1);
m6=line6(1);
b6=line6(2);
xpf6=linspace(min(point61),max(point61),100);
ypf6=m6*xpf6+b6;
point71=[15,85];
point72=[300,300];
%Allow the user to set the percent of B
b=input('Enter the mass percent of B: ');
%Return an error if the percent of B is not a valid number
if b<0 || b>100
error('Please enter a value between 0 and 100.')
end
%Allow the user to set the temperature
t=input('Enter the temperature [deg C]: ');
%Solve for percent composition of A
a=100-b;
%Determine phase based on temperature and percent composition of B using
%the phase lines
if t<300
if b<15 && t>m1*b+b1
phase='alpha';
elseif b<15 && t=15 && b<=85
phase='alpha + beta';
elseif b>85 && t>m6*b+b6
phase='beta';
else phase='alpha + beta';
end
elseif b<15
if t=15 && b<=50
if t50 && b<=85
if t=15 && b<=85 && t==300
fprintf('The provided conditions fall on the eutectic line. ')
end
if b==50 && t==300
fprintf('The provided conditions fall on the eutectic point. ')
end
%Output a formatted statement to display the phase
fprintf('For the composition of %0.2f%% A, %0.2f%% B and a temperature of %0.0f degrees
Celsius, the phase is %s. ',a,b,t,phase)
%Create a plot of the phase lines and the user's set point
figure('color','white')
%Set axes
axis([0 100 0 1000])
%Plot the phase lines, eutectic line, eutectic point, and the user's point
plot(xpf1,ypf1,'-b')
hold on
plot(xpf2,ypf2,'-b')
plot(xpf3,ypf3,'-b')
plot(xpf4,ypf4,'-b')
plot(xpf5,ypf5,'-b')
plot(xpf6,ypf6,'-b')
plot(point71,point72,'-k')
plot(b,t,'ro','MarkerFaceColor','r')
%Assign a title and axes labels
title('Phase Diagram of Elements A and B')
xlabel('Percent Composition of B')
ylabel('Temperature (T) [deg C]')
%Set scaling for the axes
set(gca,'XTick',0:10:100,'YTick',0:100:1000)
%Place the phase names on the graph
text(40,200,'alpha+beta')
text(45,600,'Liquid')
text(90,300,'beta')
text(3,300,'alpha')
text(15,375,'alpha + Liquid')
text(62,375,'beta + Liquid')

More Related Content

More from aquazac

a) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdf
a) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdfa) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdf
a) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdfaquazac
 
2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf
2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf
2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdfaquazac
 
A person may not choose to participate in the labour force due to La.pdf
A person may not choose to participate in the labour force due to La.pdfA person may not choose to participate in the labour force due to La.pdf
A person may not choose to participate in the labour force due to La.pdfaquazac
 
Well.. 1) Ionic bonds are almost always metal to .pdf
                     Well.. 1) Ionic bonds are almost always metal to .pdf                     Well.. 1) Ionic bonds are almost always metal to .pdf
Well.. 1) Ionic bonds are almost always metal to .pdfaquazac
 
1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf
1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf
1. The answer is d) Environmental EffectsEnvironmental effects ca.pdfaquazac
 
The oxygen appears in both step reactions. But, i.pdf
                     The oxygen appears in both step reactions. But, i.pdf                     The oxygen appears in both step reactions. But, i.pdf
The oxygen appears in both step reactions. But, i.pdfaquazac
 
PART A The element Si belongs to IVA group. Therefore, four electro.pdf
  PART A The element Si belongs to IVA group. Therefore, four electro.pdf  PART A The element Si belongs to IVA group. Therefore, four electro.pdf
PART A The element Si belongs to IVA group. Therefore, four electro.pdfaquazac
 
The two contributions to the cohesive energy of t.pdf
                     The two contributions to the cohesive energy of t.pdf                     The two contributions to the cohesive energy of t.pdf
The two contributions to the cohesive energy of t.pdfaquazac
 
If you are talking about an extraction design, th.pdf
                     If you are talking about an extraction design, th.pdf                     If you are talking about an extraction design, th.pdf
If you are talking about an extraction design, th.pdfaquazac
 
Yes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdf
Yes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdfYes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdf
Yes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdfaquazac
 
When something boils, it changes states of matter. It would go from .pdf
When something boils, it changes states of matter. It would go from .pdfWhen something boils, it changes states of matter. It would go from .pdf
When something boils, it changes states of matter. It would go from .pdfaquazac
 
We need to discuss why there is an importance of adding residents to.pdf
We need to discuss why there is an importance of adding residents to.pdfWe need to discuss why there is an importance of adding residents to.pdf
We need to discuss why there is an importance of adding residents to.pdfaquazac
 
What is the largest decimal integer that can be represented with the.pdf
What is the largest decimal integer that can be represented with the.pdfWhat is the largest decimal integer that can be represented with the.pdf
What is the largest decimal integer that can be represented with the.pdfaquazac
 
Throwing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdfThrowing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdfaquazac
 
This electron transport is accompanied by the protons transfer into .pdf
This electron transport is accompanied by the protons transfer into .pdfThis electron transport is accompanied by the protons transfer into .pdf
This electron transport is accompanied by the protons transfer into .pdfaquazac
 
In linear or non cyclic electron transport of photosynthesis NADPH a.pdf
In linear or non cyclic electron transport of photosynthesis NADPH a.pdfIn linear or non cyclic electron transport of photosynthesis NADPH a.pdf
In linear or non cyclic electron transport of photosynthesis NADPH a.pdfaquazac
 
The intrusion of biases is a very important issue in decision making.pdf
The intrusion of biases is a very important issue in decision making.pdfThe intrusion of biases is a very important issue in decision making.pdf
The intrusion of biases is a very important issue in decision making.pdfaquazac
 
The bond issuance will got influenced by following risks a) Infla.pdf
The bond issuance will got influenced by following risks a) Infla.pdfThe bond issuance will got influenced by following risks a) Infla.pdf
The bond issuance will got influenced by following risks a) Infla.pdfaquazac
 
Sorts of SQL StatementsThe rundowns in the accompanying segments g.pdf
Sorts of SQL StatementsThe rundowns in the accompanying segments g.pdfSorts of SQL StatementsThe rundowns in the accompanying segments g.pdf
Sorts of SQL StatementsThe rundowns in the accompanying segments g.pdfaquazac
 
Remediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdf
Remediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdfRemediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdf
Remediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdfaquazac
 

More from aquazac (20)

a) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdf
a) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdfa) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdf
a) mean = 1.43Thus distribution is Poisson(4.2)P(X = 4) = 4.2^4.pdf
 
2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf
2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf
2.a. Wired Media Type and ExplinationTwisted-Pair CableTwiste.pdf
 
A person may not choose to participate in the labour force due to La.pdf
A person may not choose to participate in the labour force due to La.pdfA person may not choose to participate in the labour force due to La.pdf
A person may not choose to participate in the labour force due to La.pdf
 
Well.. 1) Ionic bonds are almost always metal to .pdf
                     Well.. 1) Ionic bonds are almost always metal to .pdf                     Well.. 1) Ionic bonds are almost always metal to .pdf
Well.. 1) Ionic bonds are almost always metal to .pdf
 
1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf
1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf
1. The answer is d) Environmental EffectsEnvironmental effects ca.pdf
 
The oxygen appears in both step reactions. But, i.pdf
                     The oxygen appears in both step reactions. But, i.pdf                     The oxygen appears in both step reactions. But, i.pdf
The oxygen appears in both step reactions. But, i.pdf
 
PART A The element Si belongs to IVA group. Therefore, four electro.pdf
  PART A The element Si belongs to IVA group. Therefore, four electro.pdf  PART A The element Si belongs to IVA group. Therefore, four electro.pdf
PART A The element Si belongs to IVA group. Therefore, four electro.pdf
 
The two contributions to the cohesive energy of t.pdf
                     The two contributions to the cohesive energy of t.pdf                     The two contributions to the cohesive energy of t.pdf
The two contributions to the cohesive energy of t.pdf
 
If you are talking about an extraction design, th.pdf
                     If you are talking about an extraction design, th.pdf                     If you are talking about an extraction design, th.pdf
If you are talking about an extraction design, th.pdf
 
Yes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdf
Yes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdfYes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdf
Yes ,its true. Though both gibbons and rhesus monkeys belong to pr.pdf
 
When something boils, it changes states of matter. It would go from .pdf
When something boils, it changes states of matter. It would go from .pdfWhen something boils, it changes states of matter. It would go from .pdf
When something boils, it changes states of matter. It would go from .pdf
 
We need to discuss why there is an importance of adding residents to.pdf
We need to discuss why there is an importance of adding residents to.pdfWe need to discuss why there is an importance of adding residents to.pdf
We need to discuss why there is an importance of adding residents to.pdf
 
What is the largest decimal integer that can be represented with the.pdf
What is the largest decimal integer that can be represented with the.pdfWhat is the largest decimal integer that can be represented with the.pdf
What is the largest decimal integer that can be represented with the.pdf
 
Throwing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdfThrowing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdf
 
This electron transport is accompanied by the protons transfer into .pdf
This electron transport is accompanied by the protons transfer into .pdfThis electron transport is accompanied by the protons transfer into .pdf
This electron transport is accompanied by the protons transfer into .pdf
 
In linear or non cyclic electron transport of photosynthesis NADPH a.pdf
In linear or non cyclic electron transport of photosynthesis NADPH a.pdfIn linear or non cyclic electron transport of photosynthesis NADPH a.pdf
In linear or non cyclic electron transport of photosynthesis NADPH a.pdf
 
The intrusion of biases is a very important issue in decision making.pdf
The intrusion of biases is a very important issue in decision making.pdfThe intrusion of biases is a very important issue in decision making.pdf
The intrusion of biases is a very important issue in decision making.pdf
 
The bond issuance will got influenced by following risks a) Infla.pdf
The bond issuance will got influenced by following risks a) Infla.pdfThe bond issuance will got influenced by following risks a) Infla.pdf
The bond issuance will got influenced by following risks a) Infla.pdf
 
Sorts of SQL StatementsThe rundowns in the accompanying segments g.pdf
Sorts of SQL StatementsThe rundowns in the accompanying segments g.pdfSorts of SQL StatementsThe rundowns in the accompanying segments g.pdf
Sorts of SQL StatementsThe rundowns in the accompanying segments g.pdf
 
Remediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdf
Remediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdfRemediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdf
Remediation (Clean Up) of the Bhopal Plant SiteStatus of the Forme.pdf
 

Recently uploaded

OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfcupulin
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MysoreMuleSoftMeetup
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 

clear clc close all Use polyfit to solve for the phase l.pdf

  • 1. clear clc close all %Use polyfit to solve for the phase lines point11=[0,15]; point12=[0,300]; line1=polyfit(point11,point12,1); m1=line1(1); b1=line1(2); xpf1=linspace(min(point11),max(point11),100); ypf1=m1*xpf1+b1; point21=[0,15]; point22=[700,300]; line2=polyfit(point21,point22,1); m2=line2(1); b2=line2(2); xpf2=linspace(min(point21),max(point21),100); ypf2=m2*xpf2+b2; point31=[0,50]; point32=[700,300]; line3=polyfit(point31,point32,1); m3=line3(1); b3=line3(2); xpf3=linspace(min(point31),max(point31),100); ypf3=m3*xpf3+b3; point41=[50,100]; point42=[300,800]; line4=polyfit(point41,point42,1); m4=line4(1); b4=line4(2); xpf4=linspace(min(point41),max(point41),100); ypf4=m4*xpf4+b4; point51=[100,85];
  • 2. point52=[800,300]; line5=polyfit(point51,point52,1); m5=line5(1); b5=line5(2); xpf5=linspace(min(point51),max(point51),100); ypf5=m5*xpf5+b5; point61=[85,100]; point62=[300,0]; line6=polyfit(point61,point62,1); m6=line6(1); b6=line6(2); xpf6=linspace(min(point61),max(point61),100); ypf6=m6*xpf6+b6; point71=[15,85]; point72=[300,300]; %Allow the user to set the percent of B b=input('Enter the mass percent of B: '); %Return an error if the percent of B is not a valid number if b<0 || b>100 error('Please enter a value between 0 and 100.') end %Allow the user to set the temperature t=input('Enter the temperature [deg C]: '); %Solve for percent composition of A a=100-b; %Determine phase based on temperature and percent composition of B using %the phase lines if t<300 if b<15 && t>m1*b+b1 phase='alpha'; elseif b<15 && t=15 && b<=85 phase='alpha + beta'; elseif b>85 && t>m6*b+b6 phase='beta'; else phase='alpha + beta'; end
  • 3. elseif b<15 if t=15 && b<=50 if t50 && b<=85 if t=15 && b<=85 && t==300 fprintf('The provided conditions fall on the eutectic line. ') end if b==50 && t==300 fprintf('The provided conditions fall on the eutectic point. ') end %Output a formatted statement to display the phase fprintf('For the composition of %0.2f%% A, %0.2f%% B and a temperature of %0.0f degrees Celsius, the phase is %s. ',a,b,t,phase) %Create a plot of the phase lines and the user's set point figure('color','white') %Set axes axis([0 100 0 1000]) %Plot the phase lines, eutectic line, eutectic point, and the user's point plot(xpf1,ypf1,'-b') hold on plot(xpf2,ypf2,'-b') plot(xpf3,ypf3,'-b') plot(xpf4,ypf4,'-b') plot(xpf5,ypf5,'-b') plot(xpf6,ypf6,'-b') plot(point71,point72,'-k') plot(b,t,'ro','MarkerFaceColor','r') %Assign a title and axes labels title('Phase Diagram of Elements A and B') xlabel('Percent Composition of B') ylabel('Temperature (T) [deg C]') %Set scaling for the axes set(gca,'XTick',0:10:100,'YTick',0:100:1000) %Place the phase names on the graph text(40,200,'alpha+beta') text(45,600,'Liquid') text(90,300,'beta')
  • 4. text(3,300,'alpha') text(15,375,'alpha + Liquid') text(62,375,'beta + Liquid') Solution clear clc close all %Use polyfit to solve for the phase lines point11=[0,15]; point12=[0,300]; line1=polyfit(point11,point12,1); m1=line1(1); b1=line1(2); xpf1=linspace(min(point11),max(point11),100); ypf1=m1*xpf1+b1; point21=[0,15]; point22=[700,300]; line2=polyfit(point21,point22,1); m2=line2(1); b2=line2(2); xpf2=linspace(min(point21),max(point21),100); ypf2=m2*xpf2+b2; point31=[0,50]; point32=[700,300]; line3=polyfit(point31,point32,1); m3=line3(1); b3=line3(2); xpf3=linspace(min(point31),max(point31),100); ypf3=m3*xpf3+b3; point41=[50,100]; point42=[300,800]; line4=polyfit(point41,point42,1);
  • 5. m4=line4(1); b4=line4(2); xpf4=linspace(min(point41),max(point41),100); ypf4=m4*xpf4+b4; point51=[100,85]; point52=[800,300]; line5=polyfit(point51,point52,1); m5=line5(1); b5=line5(2); xpf5=linspace(min(point51),max(point51),100); ypf5=m5*xpf5+b5; point61=[85,100]; point62=[300,0]; line6=polyfit(point61,point62,1); m6=line6(1); b6=line6(2); xpf6=linspace(min(point61),max(point61),100); ypf6=m6*xpf6+b6; point71=[15,85]; point72=[300,300]; %Allow the user to set the percent of B b=input('Enter the mass percent of B: '); %Return an error if the percent of B is not a valid number if b<0 || b>100 error('Please enter a value between 0 and 100.') end %Allow the user to set the temperature t=input('Enter the temperature [deg C]: '); %Solve for percent composition of A a=100-b; %Determine phase based on temperature and percent composition of B using %the phase lines if t<300 if b<15 && t>m1*b+b1 phase='alpha'; elseif b<15 && t=15 && b<=85
  • 6. phase='alpha + beta'; elseif b>85 && t>m6*b+b6 phase='beta'; else phase='alpha + beta'; end elseif b<15 if t=15 && b<=50 if t50 && b<=85 if t=15 && b<=85 && t==300 fprintf('The provided conditions fall on the eutectic line. ') end if b==50 && t==300 fprintf('The provided conditions fall on the eutectic point. ') end %Output a formatted statement to display the phase fprintf('For the composition of %0.2f%% A, %0.2f%% B and a temperature of %0.0f degrees Celsius, the phase is %s. ',a,b,t,phase) %Create a plot of the phase lines and the user's set point figure('color','white') %Set axes axis([0 100 0 1000]) %Plot the phase lines, eutectic line, eutectic point, and the user's point plot(xpf1,ypf1,'-b') hold on plot(xpf2,ypf2,'-b') plot(xpf3,ypf3,'-b') plot(xpf4,ypf4,'-b') plot(xpf5,ypf5,'-b') plot(xpf6,ypf6,'-b') plot(point71,point72,'-k') plot(b,t,'ro','MarkerFaceColor','r') %Assign a title and axes labels title('Phase Diagram of Elements A and B') xlabel('Percent Composition of B') ylabel('Temperature (T) [deg C]') %Set scaling for the axes
  • 7. set(gca,'XTick',0:10:100,'YTick',0:100:1000) %Place the phase names on the graph text(40,200,'alpha+beta') text(45,600,'Liquid') text(90,300,'beta') text(3,300,'alpha') text(15,375,'alpha + Liquid') text(62,375,'beta + Liquid')