Plot scheduling variables in the flight envelope

10 visualizzazioni (ultimi 30 giorni)
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);

Risposte (1)

Riya
Riya il 24 Gen 2024
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:

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by