I have an equation for ploting;
x=1 to 10 nanometers ;
y=0.5 to 2 nanometers;
and k=1 to 10;(not nanometers it is a multiplication)
the equation is:
f=8.854187817.*(x.*x.*k.^2)/(y.*y);
and i need a plot for all k values from 1 to 10;
plot(f,k); ant this didn t work;

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Jan. 2017
Bearbeitet: Walter Roberson am 9 Jan. 2017

0 Stimmen

x = linspace(1,10,15);
y = linspace(0.5,2,15);
k = linspace(1,10,15);
[X,Y,K] = meshgrid(x, y, k);
f = 8.854187817.*(X.*X.*K.^2)./(Y.*Y);
However, this is essentially 4D -- three input coordinates and one result. Even if you divide it up by k value, the result would be 3D for each k value, which would make it a bit difficult to plot everything at the same time. What kind of plots were you hoping for?
pointsize = 36;
scatter3(X(:),Y(:),K(:),pointsize,f(:))
or
slice(X,Y,K,f,[],[],k)

3 Kommentare

Image Analyst
Image Analyst am 10 Jan. 2017
"three input coordinates and one result" is what I call 3D. Such data can be stored in a 3-D array. For example a volumetric image, like CT or MRI, where you have (x,y,z) coordinates and a value (like temperature, density, signal, or whatever) for each location. It can be visualized with 3D volumetric visualization programs like Avizo.
And ndims(f) reports 3.
Walter Roberson
Walter Roberson am 10 Jan. 2017
You can position on the three spatial dimensions, but for each combination of spatial dimensions you have a result that has to be plotted somehow. You cannot plot that as a 4th spatial dimension the way you can plot the height of a surface defined with two free parameters. You have to find another way to plot the 4th piece of information (the value of f). One way to do that is color; another way is to plot through time.
Mathematically, 3 input values plus one result is referred to as 4D, because you can itemize each output as a 4-tuple,
(x, y, k, f)
and mathematically "functions" are fundamentally tuples (formula are short-hand for listing all of the tuples.)
Stephen23
Stephen23 am 15 Jan. 2017
ionescu andrei's "Answer" moved here:
but how i make k natural with values between 1 to 10?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

ionescu andrei
ionescu andrei am 15 Jan. 2017

0 Stimmen

and how can i se value of F in (f) the plot?

Community Treasure Hunt

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

Start Hunting!

Translated by