-1
$\begingroup$

I am trying to plot a sinewave with a bit of 3d perspective along the ZX axis instead of the XY axis. I have so far been unable to get anything that works, and have been unable to locate any examples. I have tried a few different things with plot3() but that has all resulted in either parallel lines (no longer a sinewave) or nothing.

To add clarity, I do not want to change the labels but rather have a 3-axis plot where a 2d sinewave is on the ZX axis.

Here is the closest thing I have (just found the rotate and view commands). However the sine waves only fully render when looked at dead on, which makes one of the two invisible. I would like to be able to view both, at an angle so you can see the relationship between them.

clf;
rotate3d on;
frequency = 5;
timeperiod = 1;
dcoffset = 0;
amplitude = 0.1;
t=0:0.00001:timeperiod;
out=dcoffset+amplitude*sin(2*pi*frequency*t);
plot(t,out, "linewidth", 3);
hold on;
out=dcoffset+amplitude*sin(2*pi*frequency*t);
ew=plot(t,out, "linewidth", 3);
rotate(ew,[1 0 0], 90);
view(3,[22 45 45]);

TIA

$\endgroup$
0
$\begingroup$

Now that I know more search terms I found this. It is effectively what I wanted to do.

https://scicomp.stackexchange.com/a/14352/33469

| cite | improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.