repeated simpsons in matlab

To repeated simpsons in Matlab, you can use the plot function along with an array of x and y values. Here is an example code:

main.m
% Define the x-values
x = -10:0.1:10;

% Define the y-values
y = sin(x);

% Plot the Simpsons curve
plot(x, y, 'b');

% Plot the repeated Simpsons curves
hold on
plot(x, y-2, 'r');
plot(x, y-4, 'g');
hold off
209 chars
15 lines

In this example, we first define the x-values from -10 to 10 with a step of 0.1, and then define the y-values as the sine of the x-values. We then use the plot function to plot the Simpsons curve using the blue color.

To plot the repeated Simpson curves, we use the hold on command so that the subsequent plot commands do not overwrite the previous plot. We then add a constant value to the y-values to shift the curve downwards, and use different colors for each curve.

This will result in a plot with the original Simpsons curve in blue, and repeated curves in red and green, shifted downwards.

related categories

gistlibby LogSnag