How to plot four variables in a line graph ?

I have one equation with 4 variables (x,y,z,d).I substitute the variable x in the equation and have 3 variables. I want to plot with 3 variables in a line graph.
How can I plot this graph? Thank you very much for your answer :)

6 个评论

Show us the equation....I guess there would be some range to other variables as well i.e for (x,y,z)
I have 4 varaibles (x4,y4,z4,d) and substitute x4 in equation of volume numerical intergration (UU).I want to plot potential and range of varaible d in a line plot.Thank for help :)
Copy the code....no image snippets.....
% range of varaibles (x4,y4,z4)
x4 = 2.1*(10^-9);
y4 = -8*(10^-9):1*(10^-9):8*(10^-9);
z4 = -8*(10^-9):1*(10^-9):8*(10^-9);
% range of varaible d
d = 2*(10^-9):1*(10^-9):5*(10^-9);
% Volume integration
Vx3d = -2*(10^-9);
Vx3t = 2*(10^-9);
Vy3d = -2*(10^-9);
Vy3t = 2*(10^-9);
Vz3d = 0;
Vz3t = 4*(10^-9);
% Numerical integration
Potential = zeros(length(y4),length(z4),length(d));
for i1 = 1:length(y4)
for j1 = 1:length(z4)
for k1 = 1:length(d)
Potential(i1,j1,k1) = integral3(@(x1,y1,z1) UU(d(k1),x1,x4,y1,y4(j1),z1,z4(i1)),Vx3d,Vx3t,Vy3d,Vy3t,Vz3d,Vz3t) ;
end
end
end
@chayanon summueang: By the way, the code looks much nicer, if you replace the expensive power operation 1*(10^-9) by the fast constant 1e-9. In addition you can use the "{} Code" button instead of inserting a blank line after each line of code.
You forgot to mention the problem you have with this code.
Btw no of elements of x4 y4 are not the same.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Software Development 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by