how to plot 3D curves with for loop
Show older comments
Hello! I'm kind of beginner with matlab, however I need to plot a 3D curve. My problem is that I use a for loop to get the points because I don't see another way to proceed to avoid a problem with vectors dimensions. Here is what I do:
clear all; close all; clc;
U=400.0;
S=120000;
Phi=acos(1.0);
P=S*cos(Phi);
Q=S*sin(Phi);
I=S/(U*sqrt(3));
Zn=(U^2)/S;
delta=20.0;
for v=0:1:20
Xd=(1/Zn)*repmat(v,100,1); %abscisses
Xq=(1/Zn)*repmat(v',1,100); %ordonnées
[Xd,Xq]=meshgrid(v,v);
E1=sqrt(((U+Xq*I*sin(Phi))^2)+(Xq*I*cos(Phi))^2);
Eaf=(1/(2-Xq))*(E1+U*cos(delta)-(Xq/Xd)*U*cos(delta));
F=(-(3/2)*(U*Eaf/Xd)*sin(delta)+((U*U*(Xd-Xq))/(2*Xd*Xq))*sin(2*delta))-P;
%%%Tracé de la surface associée%%%
figure(1)
surf(Xd,Xq,F)
axis([3 6 1 6 0 10000000000]) %définition des limites des axes x,y et z.
end
And what I get is as you can see a picture with nothing on it. So what do you think I could do to solve it? Thank you for your answers.
Accepted Answer
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!