Description

Matlab Problems

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Related Documents

Share

Transcript

Chapter-1: Starting with MATLAB Question no. 16 Answer:
a=9 ; b=18; c=25; %Question (a): Rearrange the cosine equation
alpha = acosd((a^2-b^2-c^2)/(-2*b*c)) %Question (b): the value shall be 0_deg<beta<90_deg and 90_deg<gamma<180_deg beta = asind(b*sind(alpha)/a) gamma = 180-asind(c*sind(alpha)/a) %Question (c): just sum the value of alpha, beta, and gamma
check = alpha+beta+gamma
Chapter-1: Starting with MATLAB Question no. 26 Answer:
n=52; r=5;
Cnr=factorial(n)/(factorial(r)*factorial(n-r))
sin(
) =
sin(
) =
sin(
)
Chapter-2: Creating Arrays Question no. 16
(It is different from our books, but the methodology still same)
Answer:
A=[linspace(0,30,7);linspace(600,0,7);linspace(0,5,7)]
Chapter-2: Creating Arrays Question no. 30 Answer:
B=[linspace(18,13,6);linspace(12,7,6);linspace(6,1,6)]
% Question (a)
va=[B(:,2);B(:,5)]
% Question (b)
vb=[B(3,3:6)';B(:,2)]
% Question (c)
vc=[B(:,2);B(:,4);B(:,6)]
Chapter-2: Creating Arrays Question no. 39 Answer:
a=[eye(2),zeros(2,1),ones(2)]
b=[zeros(2),ones(2);zeros(1,4);ones(1,4)]
c=[ones(1,2),zeros(1,2),ones(1,1);ones(3,2),zeros(3,3)]
Chapter-3: Mathematical Operation With Array Question no. 4 Answer:
t=[0:1:8]' % it's optional to use transpose (') option
y=((20*t.^(2/3))./(t+1))-(((t+1).^2)./exp(0.3*t+5))+(2./(t+1))
Chapter-3: Mathematical Operation With Array Question no. 15
(It is different from our books, but the methodology still same)
Answer:
p=2.3;w=5.67;
t=[1,2,3,4,5];x=[2.8,2.5,2.2,1.9,1.6];y=[4,7,10,13,17];
% Question (a)
T=p*((x+y).^2).*w./y
% Question (b)
S=p*(x+y).^2/(y*w)+w*x.*t./(p*y)
Chapter-3: Mathematical Operation With Array Question no. 31
(It is different from our books, but the methodology still same)
Answer:
% Define the coefficient of x,y,z respectively
% A1 is coefficient in equation 1
A1=[3 -2 5];A2=[-4.5 2 3];A3=[5 1 -2.5];
% b1 is a function result
b1=7.5;b2=5.5;b3=4.5;
% Put all linear equation into one form of Matrix, so it will become
% [A]*[c]=[b]
% [c]=inv([A])*[b]
xyz=inv([A1;A2;A3])*([b1;b2;b3])
Chapter-4: Mathematical Operation With Array Question no. 19 Answer:
% Create temperature ranging between 200 to 400 deg Celcius with
% 20 deg increment
T=[200:20:400]';
% Assumed that coeffient value is store in *.xls file
c=xlsread('coefficient.xls','coefficient','B2:E5');
% After read it, you will find it in 4x4 matrix form
% Used it in the main equation. You can use UDF if you want :)
TSO2=c(1,1)+c(1,2)*T+c(1,3)*(T.^2)+c(1,4)*(T.^3)
TSO3=c(2,1)+c(2,2)*T+c(2,3)*(T.^2)+c(2,4)*(T.^3)
TO2 =c(3,1)+c(3,2)*T+c(3,3)*(T.^2)+c(3,4)*(T.^3)
TN2 =c(4,1)+c(4,2)*T+c(4,3)*(T.^2)+c(4,4)*(T.^3)
% Assumed that we want the result is presented in *.txt file
fid=fopen('heat_capacity.txt','w')
fprintf(fid,'Heat Capacity for Each Gas \n')
fprintf(fid,'Temp. \t SO2 \t SO3 \t O2 \t O3 \n')
fprintf(fid,'%5.0f %5.2f %5.2f %5.2f %5.2f\n',T,TSO2,TSO3,TO2,TN2)
fclose(fid)

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks