generate a surface plot
6 views (last 30 days)
Show older comments
*Check this below code to generate a surface plot. It's showing an error.*
t_res = 0.2;
c_angle = 360/30;
iact = 0.1;
V = 12;
p = 1;
%%fprintf('Slno\t\t Time\t\t Angle(degree)\t\t Current\t\t delta_i\t\t Torque\t\t Fluxlinkage\t\t L_obt\n');
for p=1:5,
Time = p*t_res;
Angle = Time*c_angle/2;
if (p == 1)
delt_i = 0;
else
delt_i = 0.5* t_res* V /L_obt;
end
iact = iact+delt_i;
[~, ~, raw] = xlsread('F:\Pradeep\Matlab\data1.xlsx','Sheet3','A2:D11');
data = reshape([raw{:}],size(raw));
Current = data(:,1);
Angle1 = data(:,2);
Torque = data(:,3);
Fluxlinkage = data(:,4);
F = scatteredInterpolant(Current,Angle1,Fluxlinkage);
Fluxlinkage = F(iact,Angle);
L_obt = Fluxlinkage/iact;
F = scatteredInterpolant(Current,Angle1,Torque);
Torque = F(iact,Angle);
Table = [p' Time' Angle' iact' delt_i' abs(Torque)' Fluxlinkage' L_obt'];
fprintf('%d\t\t %f\t\t %f\t\t %f\t\t %f\t\t %f\t\t %f\t\t %f\n', Table');
end
p=p+1;
plot3(Time,iact,Torque);
6 Comments
Answers (1)
KSSV
on 25 Oct 2017
data = [0.1 1 2.3 0.5
3 2 3.4 0.86
4 3 2.7 0.8739
5 4 4.5 0.4382
6 5 3.4 0.8234
7 6 5.5 0.53823
8 7 4.3 0.7482
9 8 4 0.3439
10 9 3.5 0.2593
11 10 2.4 0.2432];
c = data(:,1) ;
theta = data(:,2) ;
tor = data(:,3) ;
flux = data(:,4) ;
[C,T] = meshgrid(c,theta) ;
F = scatteredInterpolant(c,theta,tor) ;
Tor = F(C,T) ;
figure
surf(C,T,Tor) ;
title('surface plot of Torque')
10 Comments
See Also
Categories
Find more on Surface and Mesh Plots 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!