Dear all,
How can we plot nonlinear curve connecting set of data points in vector spaces.

4 Kommentare

Walter Roberson
Walter Roberson am 1 Jun. 2011
Can they be expressed parametrically in a linear space?
IEEE IE
IEEE IE am 1 Jun. 2011
Here is the Code..
%plot(f6,f5) simply shows dotted points..
k_wp=34.3; %Thermal Conductivity(W/mK)
row_wp=7815; %Density(kg/m3)
c_wp=506; %Specific Heat(j/KgK)
t_mp = 1697; %Melting Temperatur(K)
alpha_wp = k_wp/(row_wp*c_wp); %Thermal Deffusivity(j/m2K)
beta_wp= sqrt(k_wp*row_wp*c_wp);%Therml Property(j/m2sK)
%Thermal properties of wheel(CBN)
k_s=240; %Thermal Conductivity of abrasive grains(W/mK)
row_s=3480; %Density(kg/m3)
c_s= 506; %Specific Heat(j/KgK)
beta_s=20600; %Therml Property(j/m2sK)
r_s= 10e-6; %Effective Contact Radious of abrasive grains(m)
%Thermal properties of fluid(neat oil)
k_f = 0.14; %Thermal Conductivity(W/mK)
row_f=900; %Density(kg/m3)
c_f= 2100; %Specific Heat(j/KgK)
beta_f= sqrt(k_f*row_f*c_f); %Therml Property(j/m2sK)
tb = 573; %Fluid boiling point(K)
%process parameters
a = .0001; %depth ofcut(m)
b = 0.02; %Width of wheel(m)
d = 0.2; %Wheel diameter(m)
v_w = .06; %Workspeed(m/s)
v_s = 16; %Wheel speed(m/s)
lc = (1 + v_w/v_s)*sqrt(d*a); %Contact length(m)
t= 211; %Contact time(s)
p= .55; %Peclet number
ft=150; %Tangential Force(N)
%Removal rate per unit width
%q = a*v_w;
% Specific enegy = (Specific power/ MRR)
%Specific power,p = ft*v_s
% Total heta flux = p/(lc*b)
qt = (ft*v_s)/(lc*b);
% Heat flux to Chip(conduction factor, h_ch)
h_ch = (row_wp*c_wp*v_w)*(a/lc);
%Heat flux to the Fluid (conduction factor, h_ch)
hf= 0.94*beta_f*sqrt(v_s/lc); %Fluid Convection Factor(W/m2K)
% Heat flux to the workpiece(conduction factor, h_wp)
h_wp = (beta_wp/c_wp)* sqrt(v_w/lc);
% Heat flux to the wheel(conduction factor, h_w)
r_ws = inv(1+ ((0.97*k_s)/(beta_wp*sqrt(r_s*v_s)))); %Wrkpiece-wheel partition ratio
h_s = h_wp*( (inv(r_ws)) -1 );
% Maximim temperature Calculation
% C= Correction factor
tmax1 = (qt -(h_ch*t_mp))/((h_wp/r_ws)+hf);
tmax2 = (qt -(h_ch*t_mp))/(h_wp/r_ws);
if (tmax1>= tb)
tmax = tmax2;
else
tmax = tmax1;
end
tmax
% Heat flux to the workpiece
t= 5;
q_wp = h_wp * tmax;
%ri = sqrt((x - xi)^2 + (z- zi)^2);
%u = (v_wp*ri)/(2*alpha_wp);
%tao = t - ti;
%p= (v_w^2 * t)/(4*alpha_wp);
%omg = (v_w^2 * tao )/(4*alpha_wp);
%f1 = (exp(-omg - (u^2/(4*omg))))/omg ;
syms a
z= 0;
for x =-lc/2:.0002: lc/2;
% w is the parameter we change
f2 = exp((v_w*(x-a))/(2*alpha_wp));
u = (v_w* sqrt((x-a).^2 + z.^2))/(2*alpha_wp);
m = q_wp/(pi*k_wp);
f3 = besselk(0 , u);
f4 = int((m*f2*f3), a, -lc/2 , lc/2 );
f4 = vpa (f4,2);
f5 = (3.1416*k_wp*v_w*f4)/(2*alpha_wp*q_wp);
f5 = vpa (f5,4);
f5 = double (f5);
f6 = 2*(x/lc);
xlabel('x/lc (dimension less)');
ylabel('Dimensionless Temp');
plot(f6,f5)
hold on
end
Oleg Komarov
Oleg Komarov am 1 Jun. 2011
Edit your post adding the code inside the cody and formatting it properly: http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question
John
John am 9 Mai 2024
Bearbeitet: John am 9 Mai 2024
To plot a nonlinear curve connecting a set of data points in vector spaces , you can use the spline function along with plot. example:
% Data points
x = [-1, 0, 1, 2, 3];
y = [2, 1, 3, 2, 4];
% Generate a fine mesh of points for the curve
x_fine = linspace(min(x), max(x), 100);
% Interpolate using spline
y_fine = spline(x, y, x_fine);
% Plot the data points and the curve
plot(x, y, 'o', 'MarkerSize', 8, 'MarkerFaceColor', 'blue');
hold on;
plot(x_fine, y_fine, 'r-', 'LineWidth', 2);
xlabel('x');
ylabel('y');
title('Nonlinear Curve Connecting Data Points');
legend('Data Points', 'Curve');
grid on;
  1. define the data points as vectors x and y.
  2. generate a fine mesh of points x_fine using linspace to create a smooth curve. The number of points can be adjusted as needed.
  3. use the spline function to interpolate the data points. It takes the original x and y data points and the fine mesh x_fine as inputs and returns the corresponding interpolated values y_fine.
  4. plot the data points using plot with circular markers ('o') in blue color.
  5. use hold on to keep the current plot and add the curve on top of it.
  6. plot the curve using plot with the fine mesh points x_fine and y_fine, specifying a red solid line ('-') with a line width of 2.
  7. add labels for the x-axis, y-axis, and title using xlabel, ylabel, and title, respectively.
  8. add a legend to identify the data points and the curve using legend.
  9. Finally, add a grid to the plot using grid on.
This code will produce a plot with the data points connected by a smooth nonlinear curve. The spline function is used for interpolation, which generates a piecewise polynomial curve that passes through all the data points.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Tags

Gefragt:

am 1 Jun. 2011

Bearbeitet:

am 9 Mai 2024

Community Treasure Hunt

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

Start Hunting!

Translated by