Effacer les filtres
Effacer les filtres

How to plot 3d line on fit function?

2 vues (au cours des 30 derniers jours)
Jan Kowalski
Jan Kowalski le 10 Déc 2017
Commenté : Jan Kowalski le 11 Déc 2017
I want to show how works heuristic algorithm. I have my cost function and i want show every step of algorithm. For example i have cod:
load franke
sf = fit([x, y],z,'poly23')
subplot(1,2,1)
plot(sf)
subplot(1,2,2)
X=x(10:15)
Y=y(10:15)
Z=z(10:15)
plot3(X,Y,Z,'-mo')
grid on
How to show both on one 3D plot?

Réponse acceptée

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan le 10 Déc 2017
Modifié(e) : Kaushik Lakshminarasimhan le 10 Déc 2017
You need to use hold on. For example,
x = rand(100,1);
y = rand(100,1);
z = x.^2 + y;
sf = fit([x, y],z,'poly23')
plot(sf); hold on;
X=x(10:15)
Y=y(10:15)
Z=z(10:15)
plot3(X,Y,Z,'mo')
grid on;
  1 commentaire
Jan Kowalski
Jan Kowalski le 11 Déc 2017
So simply ... Thanks man

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by