3d plotting of multiple sets of data

1 view (last 30 days)
Gilang Septawijaya
Gilang Septawijaya on 12 Jul 2023
Answered: Dyuman Joshi on 12 Jul 2023
i want to create 3d plot using plot3 function but i get error in my code
here is my code:
plot3([40 1.25 0.01107],[40 2.5 0.02238],[40 5 0.04485],[40 10 0.08865],[40 12.5 0.1108],[40 20 0.1772],[40 25 0.2215],[40 40 0.3551],[40 50 0.4431],...
[50 1.25 0.02122],[50 2.5 0.04307],[50 5 0.08686],[50 10 0.1719],[50 12.5 0.2148],[50 20 0.3435],[50 25 0.4286],[50 40 0.6852],[50 50 0.8564],...
[60 1.25 0.03306],[60 2.5 0.06777],[60 5 0.136],[60 10 0.2696],[60 12.5 0.3371],[60 20 0.5378],[60 25 0.6725],[60 40 1.072],[60 50 1.342],...
[70 1.25 0.04706],[70 2,5 0,09508],[70 5 0.1917],[70 10 0.3794],[70 12.5 0.4715],[70 20 0.7539],[70 25 0.9413],[70 40 1.5],[70 50 1.879],...
[81 1.25 0.06227],[81 2.5 0.1262],[81 5 0.2545],[81 10 0.5059],[81 12.5 0.6323],[81 20 1.013],[81 25 1.267],[81 40 2.032],[81 50 2.541],[90 1.25 0.07809]);

Answers (1)

Dyuman Joshi
Dyuman Joshi on 12 Jul 2023
You have total of 49 sets of points, which you can not plot via plot3. The number of inputs, to plot multiple set of data, must be a divisible of 3.
Going through the pattern of the input (displayed in form of rows here), the last set of points i.e. [90 1.25 0.07809], seems to be extra.
And there is a typo in defining numbers in numbers in the 29th set (4th row, 2nd set), you have used a comma instead of decimal point.
plot3() works fine after removing the extra data set and correcting the typo.
plot3([40 1.25 0.01107],[40 2.5 0.02238],[40 5 0.04485],[40 10 0.08865],[40 12.5 0.1108],[40 20 0.1772],[40 25 0.2215],[40 40 0.3551],[40 50 0.4431],...
[50 1.25 0.02122],[50 2.5 0.04307],[50 5 0.08686],[50 10 0.1719],[50 12.5 0.2148],[50 20 0.3435],[50 25 0.4286],[50 40 0.6852],[50 50 0.8564],...
[60 1.25 0.03306],[60 2.5 0.06777],[60 5 0.136],[60 10 0.2696],[60 12.5 0.3371],[60 20 0.5378],[60 25 0.6725],[60 40 1.072],[60 50 1.342],...
[70 1.25 0.04706],[70 2.5 0.09508],[70 5 0.1917],[70 10 0.3794],[70 12.5 0.4715],[70 20 0.7539],[70 25 0.9413],[70 40 1.5],[70 50 1.879],...
...%2 typos ^ ^
[81 1.25 0.06227],[81 2.5 0.1262],[81 5 0.2545],[81 10 0.5059],[81 12.5 0.6323],[81 20 1.013],[81 25 1.267],[81 40 2.032],[81 50 2.541])

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!