Matlab绘图——对称曲线绘制(转)

转自 http://blog.csdn.net/lyqmath/article/details/6004885

目的:对曲线数据做对称绘制

思想:根据两曲线按a对称,则x1 + x2 = 2a的原则

代码:

clc; clear all; close all;

x = linspace(-10, 10);
y = x.^3;
a = 5;

figure; hold on; box on;
plot(x, y, 'b-');
x1 = 2*a-x;
y1 = y;
plot(x1, y1, 'r-')
plot([a a], [y(1) y(end)], 'k:', 'LineWidth', 2);

结果:

结论:

基于简单的数学对称思想,绘制按值对称的曲线。

原文地址:https://www.cnblogs.com/aminxu/p/4632382.html