🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Altair Compose® Challenge #1: Plotting in Compose with different types of axes

User: "RSGarciarivas"
Altair Employee
Updated by RSGarciarivas

The main scripting language in Compose, OML, features a rich set of plotting commands for creating 2D and 3D plots. In this challenge we will explore some of them as well some nice features for arranging your plots.

When I was new to engineering scripting languages (Compose, Octave, MATLAB, etc.), I often was able to perform all the calculations I had to but had trouble in the last step of the process, I got stuck in displaying the results in a meaningful way. After going over this challenge, you will be ready to plot your data in different ways the next time you have to.

Download the attached script and follow the comments in there to create all plots. As you will see from the script, all plotting tasks should be done using this data:

x = 1:100;

y = x.^2;

z = x' * y / 2;

theta = 0:0.01:2*pi;

rho = cos(theta + 2*theta).*cos(theta);

The challenge is for you to display these vectors in the following types of plots:

  • Conventional linear axes plot
  • Scatter plot
  • Logarithmic axes plots
  • 3D line and surface plots
  • Polar plot

After plotting in individual figures, create two new figures, one which contains all plots with logarithmic axes and another one containing all 3D plots, however you want to arrange them.

Good luck!

Tip: Check out OML functions like figure, grid, plot, scatter, semilogx, semilogy, loglog, plot3, surf, polar and subplot.

Level: Easy

Product Required: Compose 2020 or later version (including Personal Edition)

The solution can be attached in the comment section of this post. The desired output format is a zip file containing the plots created as JPG images. These images can be saved directly from Compose or they can be screenshots.

Edit: The solution to this challenge has been attached as another OML script. Try to solve it on your own before looking at it!