フィルターのクリア

my matlab code is wrong

2 ビュー (過去 30 日間)
Piyanut Nanta
Piyanut Nanta 2016 年 1 月 24 日
編集済み: Walter Roberson 2016 年 1 月 24 日
I'm working on a related to moving objects in a projectile path with external forces from gravity, air resisted and spinning.
Here is my matlab code:
clear all
clc
%Input parameters
h=input('Height in m.(h): ');
%Define assumed parameters
h1=4.75; %in m.
rt=0.21; %in m.
r=2.00; %in m.
g=9.81; %in m/sec^2.
Kd=0.028894; %
m=0.180; %in Kg.
%Initial
theta=atan(2*(h1+rt-h)/r)
theta1=theta*(360/(2*pi))
%หาvoของmodel 1
vm1=sqrt((r*g)/(cos(theta)*sin(theta)))
%หาvoของmodel 2
syms v
V2=vpasolve((-(cos(theta)*sin(theta))/((Kd^2/m^2)*(v^2)*cos(theta)*sin(theta)+g*(Kd/m)*cos(theta)))+((sin(theta)^2*v^2)/(((Kd^2/m^2)*v^4*sin(theta)^2)+(2*g*(Kd/m)*v^2*sin(theta))+(g^2))) == (r/(-(Kd/m)*v^2*cos(theta))), v)
% model 1
tm1=r/(vm1*cos(theta))
Here is the result
Height in m.(h): 0.5
theta =
1.3502
theta1 =
77.3624
vm1 =
9.5867
V2 =
- 3.2665320034196818433565986779223 + 7.2083367243350947875815002536584i
- 3.2665320034196818433565986779223 - 7.2083367243350947875815002536584i
7.9139338928729354872162798794152i
-7.9139338928729354872162798794152i
3.2665320034196818433565986779223 + 7.2083367243350947875815002536584i
3.2665320034196818433565986779223 - 7.2083367243350947875815002536584i
tm1 =
0.9536
The result i got seems to be in corect. The results are complex numbers. And the result is not right. I'm wondering if my matlab code is wrong. Or if i can use other comands instead of "vpasolve"

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by