Plot scheduling variables in the flight envelope
조회 수: 16 (최근 30일)
이전 댓글 표시
Hello. Actually I am simulating the GainSchedulingAutoPilotExample.m and I want to plot the scheduling variables (alpha and V0 in the flight envelope. Below is the code which I have written but its not showing any result. It would be great if anyone could help me through this.
open_system('rct_airframeGS')
nA = 5; % number of alpha values
nV = 9; % number of V values
[alpha,V] = ndgrid(linspace(0,20,nA)*pi/180,linspace(700,1400,nV));
figure
plot(alpha,V);
댓글 수: 0
답변 (1개)
Riya
2024년 1월 24일
Hello,
It looks like you are trying to plot a grid of scheduling variables (alpha and V) on a 2D plot. However, the `plot` function you're using is designed for plotting 2D lines or points, not grids. To visualize the flight envelope with respect to alpha and V, you might want to use a different plotting function, such as `meshgrid` and `surf` or `mesh` for a 3D surface plot, or `contour` for a 2D contour plot.
Here's an example of how you could modify your code to create a 2D contour plot of the flight envelope:
open_system('rct_airframeGS')
nA = 5; % number of alpha values
nV = 9; % number of V values
[alpha,V] = ndgrid(linspace(0,20,nA)*pi/180,linspace(700,1400,nV));
% Assuming that you have a function 'performanceMetric' that calculates some performance metric
% based on alpha and V, you would calculate it like this:
performanceMetric = someFunction(alpha, V); % Replace 'someFunction' with the actual function
% Now plot the contour map
figure
contourf(alpha*180/pi, V, performanceMetric) % Convert alpha back to degrees for plotting
xlabel('Angle of Attack (alpha) [degrees]')
ylabel('Airspeed (V) [m/s]')
title('Flight Envelope with Scheduling Variables')
colorbar % Optional: Adds a color bar to indicate the values
Please note that `someFunction` should be replaced with the actual function that computes the performance metric you're interested in plotting. The `performanceMetric` would be a matrix where each element corresponds to the computed metric for the combination of alpha and V at that grid point.
For more information about system level simulation refer following documentation:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!