Plot velocity vector vs time

조회 수: 9 (최근 30일)
Backtobasics
Backtobasics 2017년 10월 1일
편집: Backtobasics 2017년 10월 1일
Hi there,
I have the following task and I don't know how to implement it:
So I have the general solution for the vector
v(t)=(u(t); v(t); w(t))
which is
v=-inv(phiRV)*phiRR*dr0
where phiRV, phiRR are time-dependent 3x3-matrices and dr0 is another 3x1-vector.
Now I have to calculate v for each t=1:1200:1200.
As you can guess, so far I haven't succeeded. One problem is that I don't really have an idea what the plot should look like, I have never done something like this before. And then there's the implementation code-wise, of course.
I hope you can help me with that, thank you! :)

답변 (1개)

Image Analyst
Image Analyst 2017년 10월 1일
You don't do this:
t=1:1200:1200;
you do this:
t=1:1200;
Then to plot v vs. t, do this:
plot(t, v, 'b-', 'LineWidth', 2);
grid on;
title('v vs. t', 'FontSize', 20);
xlabel('t', 'FontSize', 20);
ylabel('v', 'FontSize', 20);
Assuming your equation for v is really delta v. Otherwise we need to know what the delta is from, like v(0) or is it the prior v, like you'd get from diff(v).
  댓글 수: 4
Backtobasics
Backtobasics 2017년 10월 1일
Probably you need the full task as well:
clear all; close all; clc;
syms t
% given parameters
mu=398600;
r=6378+590;
n=sqrt(mu/(r^3));
dr0=[0; 0; 0];
dv0=[0.02; -0.04; -0.1];
phiVR=[3*n*sin(n*t) 0 0;
6*n*(cos(n*t)-1) 0 0;
0 0 -n*sin(n*t)];
phiVV=[cos(n*t) 2*sin(n*t) 0
-2*sin(n*t) 4*cos(n*t)-3 0
0 0 cos(n*t)];
phiRR=[4-3*cos(n*t) 0 0;
6*(sin(n*t)-n*t) 1 0;
0 0 cos(n*t)];
phiRV=[1/n*sin(n*t) 2/n*(1-cos(n*t)) 0;
2/n*(cos(n*t)-1) 1/n*(4*sin(n*t)-3*n*t) 0;
0 0 1/n*sin(n*t)];
% distance to HST at t=600s
dr=simplify(subs(phiRR*dr0+phiRV*dv0, t, 600));
% deltaV necessary to reach HST after 10min:
dr0=dr; %distance to HST at new time t=0, start of maneuver
dv0=-inv(phiRV)*phiRR*dr0 %dv0 is equal to delta v from task
% plot deltaV:
t=1:1200;
plot(t, dv, 'b-', 'LineWidth', 2);
Backtobasics
Backtobasics 2017년 10월 1일
편집: Backtobasics 2017년 10월 1일
I finally made it now! The main problem was that I always thought it should be some kind of 3D plot etc. because its a 3D vector. And that I said "syms t" in the beginning so here's my little workaround:
k=linspace(1, 1200, 1200);
semilogx(k, subs(dv0, t, k))
Thank you so much for your support!

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by