clc
close all
clear
ang_vel=60;
angle_flex=60;
X=angle_flex;
Y=ang_vel;
Z=40;
torque_male_flex=[56.4 62.9 63.0 60.3 56.4;41.2 43.9 44.7 42.3 35.7;36.1 38.0 38.7 36.8 27.9;32.1 33.9 33.1 29.2 18.7;0 30.0 27.9 21.5 12.0;0 0 25.7 18.4 8.4];
torque_female_flex=[26.2 30.4 32.0 32.4 30.4;20.4 20.8 21.4 20.8 18.3;18.9 19.4 19.9 19.0 15.2;15.9 18.2 17.9 15.6 11.3;0 14.4 15.8 13.2 8.1;0 0 14.1 13.2 8.7];
vel=[0 0 0 0 0;60 60 60 60 60;120 120 120 120 120;180 180 180 180 180;240 240 240 240 240;300 300 300 300 300];
vel2=[300 300 300 300 300;240 240 240 240 240;180 180 180 180 180;120 120 120 120 120;60 60 60 60 60;0 0 0 0 0;];
ang2=[15 40 65 90 110;15 40 65 90 110;15 40 65 90 110;15 40 65 90 110;15 40 65 90 110;15 40 65 90 110];
f=createFit(ang2, vel2, torque_male_flex);
title('tva surface - male elbow flexion');
xlabel('velocity')
ylabel('angle')
zlabel('torque')
hold on
plot3(X,Y,Z,'o','MarkerSize',10);
plot3(X,-50:300,Z,'o','MarkerSize',1);
for i=0:0.01:300
val=f(angle_flex,i);
if (round(val,2)==Z)disp('intersection');
in=i;
end
end
plot3(angle_flex,in,Z,'o','MarkerSize',10)
function [fitresult, gof] = createFit(ang2, vel2, torque_male_flex)
[xData, yData, zData] = prepareSurfaceData( ang2, vel2, torque_male_flex );
ft = 'thinplateinterp';
[fitresult, gof] = fit( [xData, yData], zData, ft, 'Normalize', 'on' );
figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, [xData, yData], zData );
legend( h, 'untitled fit 1', 'torque_male_flex vs. ang2, vel2', 'Location', 'NorthEast', 'Interpreter', 'none' );
xlabel( 'ang2', 'Interpreter', 'none' );
ylabel( 'vel2', 'Interpreter', 'none' );
zlabel( 'torque_male_flex', 'Interpreter', 'none' );
grid on