As a note , all of the code above calculating a is just to calculate the intermediate variables that are needed for a
Why does this matrix have zeros for all but one of the numbers?
6 ビュー (過去 30 日間)
古いコメントを表示
So I am trying to solve a differential equation in Matlab so that I can plot how x will vary with the variable I have named thrustloading, In trying to do so I have tried to define a, b and c for the general form of the differential equation, where b and c are constant and a varies with the thrustloading. I have defined thrustloading as a 31x1 matrix ranging from 0 to 3 in increments of 0.1, when I put this into the equation for a the output is a 1x31 matrix but all of the values in this matrix are zero except for the last one but from calculating by hand none of these should be zero. any ideas on what I need to do to get this to solve correctly? my code and the values for a I obtain are below:
>> clear,
thrustloading = transpose(0:0.1:3);
delta = 1;
theta =1.0849;
CLmax=2.4;
kto=1.2;
friction=0.07;
Cdr=0.1;
Cd0=0.014;
K1=0.0375;
Mto=0.1;
tr=3;
beta=1;
gamma=1.4;
TR=1.087;
g=9.81;
sigma = delta/theta;
theta0=theta*(1+((gamma-1)/2)*Mto^2);
delta0=delta*(1+((gamma-1)/2)*Mto^2)^(gamma/(gamma-1));
density=1.225*sigma;
alpha=delta0*(1-0.49*(sqrt(Mto)));
CL=CLmax/kto^2;
Cd=(K1*CL^2)+Cd0;
XI=Cd-friction*CL;
a=-(beta/(sigma*density*g*XI))*log(1-XI/ ...
((((alpha/beta)*thrustloading)-friction)*CL))
b=tr*kto*sqrt(2*beta/(sigma*density*CLmax))
c = 3048
value for a is:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0236722117939133
採用された回答
A Jenkins
2015 年 2 月 5 日
Note the difference if you change the division to use ./ instead of /
a=-(beta/(sigma*density*g*XI))*log(1-XI./ ...
((((alpha/beta)*thrustloading)-friction)*CL))
a =
-0.834162153654705
4.013176536171804
0.589161426270873
0.317923114409717
0.217699010737579
0.165519595163022
0.133517356368411
0.111885044967989
0.096285063356605
0.084502933406256
0.075289919897257
0.067888329702154
0.061811749570266
0.056733611226660
0.052426515897960
0.048727246791412
0.045515617812328
0.042701169592895
0.040214513974658
0.038001536335358
0.036019412322791
0.034233809371935
0.032616881288226
0.031145805516796
0.029801699159175
0.028568804056074
0.027433866112957
0.026385656916161
0.025414600983100
0.024512482399452
0.023672211793913
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!