Wrapping of cubic equation

1 view (last 30 days)
tan
tan on 20 Jan 2017
Answered: Bjorn Gustavsson on 20 Jan 2017
Hi all,
I am currently trying to wrap a cubic equation between 0 and 2pi as shown on the diagram on the right. The code to generate the cubic plot is as shown below. Appreciate if you guys can provide a solution for this.
Matlab coding for cubic Plot:
clc;
close all;
clear all;
N = 10;
a=-N:0.1:N
CubicPlot=0.0628.*a.^3;
plot(a,CubicPlot)
xlabel('SLM Position[mm]');
ylabel('Phase[rads]');
hold;
plot(10,62.93,'r.','MarkerSize',30)
plot(0,0,'r.','MarkerSize',30)
plot(-10,-62.93,'r.','MarkerSize',30);
axis([-10,10,-100,100]);

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 20 Jan 2017
Perhaps what you want is something like this:
f_wrapped = rem(f,2*pi);
HTH

Tags

Community Treasure Hunt

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

Start Hunting!