I want to plot graph for my intersatellite range rate. How can i do that
3 views (last 30 days)
Show older comments
here is the given code :
recPos = [-7500 12500 15000];
recVel = [112.5 100.66 -50];
transPos = [-8337.5 7330.13 -12000];
transVel = [112.5 100.66 -40];
startTime = datetime(2021,4,25);
stopTime = datetime(2021,4,26);
sampleTime = 60;
sc = satelliteScenario(startTime,stopTime,sampleTime);
gs = groundStation(sc);
[p,pdot] = pseudoranges(recPos,transPos,recVel,transVel);
disp('Range between Satellites:');
disp(pseudoranges(recPos,transPos));
plot(pdot);
1 Comment
Sam Chak
on 25 Feb 2024
Hey @Toshi, I wanted to inquire if the issue regarding plotting the intersatellite range rate has been resolved. It's an intriguing problem, and I'm curious to know if there have been any recent developments or breakthroughs.
Accepted Answer
Hassaan
on 12 Jan 2024
% Define the initial positions and velocities
recPos = [-7500, 12500, 15000];
recVel = [112.5, 100.66, -50] / 3600; % Convert to km/s
transPos = [-8337.5, 7330.13, -12000];
transVel = [112.5, 100.66, -40] / 3600; % Convert to km/s
% Define the time parameters
startTime = datetime(2021, 4, 25);
stopTime = datetime(2021, 4, 26);
sampleTime = 60; % Sampling time in seconds
% Calculate the number of samples
numSamples = hours(stopTime - startTime) * (3600 / sampleTime);
% Initialize arrays to store the range rate and time vector
rangeRates = zeros(numSamples, 1);
timeVec = startTime:seconds(sampleTime):stopTime - seconds(sampleTime);
% Calculate the range rate at each sample
for i = 1:numSamples
% Update the positions based on the velocities
recPos = recPos + recVel * sampleTime;
transPos = transPos + transVel * sampleTime;
% Calculate the range as the Euclidean distance between recPos and transPos
range = norm(recPos - transPos);
% Calculate the range rate as the dot product of the relative velocity
% and the unit vector in the direction from recPos to transPos
relativeVelocity = recVel - transVel;
rangeRates(i) = dot(relativeVelocity, (transPos - recPos) / range);
end
% Plot the range rate
figure;
plot(timeVec, rangeRates);
title('Intersatellite Range Rate Over Time');
xlabel('Time');
ylabel('Range Rate (km/s)');
grid on;
This script calculates the range rate at each time step and then plots it. It assumes a linear motion model for the satellites, which might not be accurate in a real-world scenario, but it's sufficient for demonstrating the concept with dummy data.
Make sure to replace the pseudoranges function call with actual code to compute the range and range rate, as the provided snippet is just a placeholder based on a simplified model. If you have a more accurate way to calculate the range and range rate, use that instead.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.
0 Comments
More Answers (0)
See Also
Categories
Find more on Satellite and Orbital Mechanics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!