Category: Matlab
Category Archives: Matlab
Unable to create mex function ‘XX_Simulinkfunction_sfun.mexw64’ required for simulation.
I am trying to call custom c code in my stateflow and got below error
Making simulation target "XX_Simulinkfunction_sfun", … Microsoft (R) Program Maintenance Utility Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option ‘-‘ Stop.
Component:Make | Category:Make error
Unable to create mex function ‘XX_Simulinkfunction_sfun.mexw64’ required for simulation.
example.c
#include "example.h"
double busactive(double u1, double u2)
{
double retval;
retval = u1 + u2;
return (retval);
}
example.h
#define TRUE 1
#define FALSE 0
#define MAYBE 2
double busactive(double, double);
added #include "example.h" in simulation target Header file section and example.c is source file section.
using 2018a matlab and MEX configured to use ‘Microsoft Visual C++ 2017 (C)’ for C language compilation.
Could anyone help me solving this issue.I am trying to call custom c code in my stateflow and got below error
Making simulation target "XX_Simulinkfunction_sfun", … Microsoft (R) Program Maintenance Utility Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option ‘-‘ Stop.
Component:Make | Category:Make error
Unable to create mex function ‘XX_Simulinkfunction_sfun.mexw64’ required for simulation.
example.c
#include "example.h"
double busactive(double u1, double u2)
{
double retval;
retval = u1 + u2;
return (retval);
}
example.h
#define TRUE 1
#define FALSE 0
#define MAYBE 2
double busactive(double, double);
added #include "example.h" in simulation target Header file section and example.c is source file section.
using 2018a matlab and MEX configured to use ‘Microsoft Visual C++ 2017 (C)’ for C language compilation.
Could anyone help me solving this issue. I am trying to call custom c code in my stateflow and got below error
Making simulation target "XX_Simulinkfunction_sfun", … Microsoft (R) Program Maintenance Utility Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option ‘-‘ Stop.
Component:Make | Category:Make error
Unable to create mex function ‘XX_Simulinkfunction_sfun.mexw64’ required for simulation.
example.c
#include "example.h"
double busactive(double u1, double u2)
{
double retval;
retval = u1 + u2;
return (retval);
}
example.h
#define TRUE 1
#define FALSE 0
#define MAYBE 2
double busactive(double, double);
added #include "example.h" in simulation target Header file section and example.c is source file section.
using 2018a matlab and MEX configured to use ‘Microsoft Visual C++ 2017 (C)’ for C language compilation.
Could anyone help me solving this issue. nmake : fatal error u1065 MATLAB Answers — New Questions
How to use C Caller block with C code having multiple functions ?
I want to use a C language code into simulink which has multiple functions in it. Can it be done by C Caller block.I want to use a C language code into simulink which has multiple functions in it. Can it be done by C Caller block. I want to use a C language code into simulink which has multiple functions in it. Can it be done by C Caller block. simulink, code generation MATLAB Answers — New Questions
Error in gui_mainfcn
function varargout = Ausgabe(varargin)
% AUSGABE MATLAB code for Ausgabe.fig
% AUSGABE, by itself, creates a new AUSGABE or raises the existing
% singleton*.
%
% H = AUSGABE returns the handle to a new AUSGABE or the handle to
% the existing singleton*.
%
% AUSGABE(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in AUSGABE.M with the given input arguments.
%
% AUSGABE(‘Property’,’Value’,…) creates a new AUSGABE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Ausgabe_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Ausgabe_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Ausgabe
% Last Modified by GUIDE v2.5 18-Jul-2019 11:15:33
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @Ausgabe_OpeningFcn, …
‘gui_OutputFcn’, @Ausgabe_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before Ausgabe is made visible.
function Ausgabe_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Ausgabe (see VARARGIN)
% Choose default command line output for Ausgabe
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Ausgabe wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = Ausgabe_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% — Executes on button press in Mark_pos.
function Mark_pos_Callback(hObject, eventdata, handles)
% hObject handle to Mark_pos (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global position pathname
uiwait(msgbox(‘please choose the Markerposition-Datei!’,’Achtung’,’modal’));
% [filename, pathname] = uigetfile( ‘*.mat’);
if isempty(pathname)==1
[filename, pathname] = uigetfile(‘*.mat’);
else
filename = uigetfile([pathname,’*.mat’]);
end
load(fullfile(pathname,filename));
p=position;
vid_lad_Callback(hObject, eventdata, handles);
% — Executes on button press in vid_lad.
function vid_lad_Callback(hObject, eventdata, handles)
% hObject handle to vid_lad (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global position sgf sgf2 h_w tetha_w alpha_w L knie_w knie_w2 d3_l sprung_w pedal_w kurbel_w fx fz F F_res beta_w beta_w2 fres kurbel_w0_index gew gew2 ho x0 y0 x1 y1 x2 y2
%% Winkelmessung
h=position.h;
knie=position.knie;
sprung=position.sprung;
fuss=position.fuss;
fx=position.kraftx(:,1);
fz=position.kraftz(:,1);
axes(handles.axes1);
%% Kniewinkelberechnungen
for i=1:length(h)
P0 = knie(i,:); %definieren Knie als Ursprungspunkt
P1 = h(i,:); %definieren H?ft als P1
P2 = sprung(i,:); %definieren Sprunggelenk als P1
n1 = (P2 – P0) / norm(P2 – P0); % Normalized vectors = Betr?g des Vektors
n2 = (P1 – P0) / norm(P1 – P0); % Normalized vectors = Betr?g des Vektors
knie_w(i) = acosd(dot(n1, n2)); % Kniewenkel
end
%%
%input Gewicht und L?nge des Unterschenkels
if isempty(gew)==1
gew={’95’};
gew2={‘5’};
L={‘0.4’};
else
gew={num2str(gew)};
gew2={num2str(gew2)};
L={num2str(L)};
end
gew=inputdlg({‘please enter body weight in kg’},’body weight’,1,gew);
gew=str2num(gew{1});
gew2=inputdlg({‘please enter weight plate in kg’},’weight’,1,gew2);
gew2=str2num(gew2{1});
L=inputdlg({‘please enter length of lower leg in m’},’length’,1,L);
L=str2num(L{1});
%% Variablen berechnen
%Patellarsehne-winkel berechnen
knie_w2 = knie_w’;
beta_w = -0.000012941919 .* (knie_w2 .^3) + 0.004613095238 .* (knie_w2 .^2) – 0.204942279942 .* knie_w2 – 14.142857142856;
beta_w2 = abs(beta_w);
%Winkel zwischen Tibia und y-Achse
alpha_w2 = knie_w2 – 90;
alpha_w = abs(alpha_w2);
%Winkel zwischen Femur und Patellarsehne-winkel
tetha_w = knie_w2 – beta_w;
%Hebel?rme
d1 = L * sind(alpha_w) * 0.43;
d2 = L * sind(alpha_w);
d3 = L / 5 * sind(beta_w2);
d3_l = (0.0000000002434 .* (knie_w2 .^6) – 0.0000001568469 .* (knie_w2 .^5) + 0.0000394291959 .* (knie_w2 .^4) – 0.0049457648343 .* (knie_w2 .^3) + 0.3289434274828 .* (knie_w2 .^2) – 11.0152767344929.* knie_w2 + 170.0411753969300) / 1000;
%Gewichte
gew_fuss = 5.3 / 100 * gew;
gew_last = gew2 + 6.853; %plus gewicht der Halterung 6.853 kg
%% Kr?fte Berechnen
%Bandkraft
F1 = (fx * (L – 0.05) + gew_fuss * 9.81 * d1 + gew_last * 9.81 * d2);
F = F1 ./ d3_l;
%Femoropatellarkraft
F_res = sqrt( 2 .* (F .^2) + 2 .* (F .^2) .* cosd (tetha_w));
% %% Berechnung der Mittelwerte
%
% %suchen die min. Winkel-Werte
% [AP, locs] = findpeaks(sgolayfilt(knie_w2,3,51),’MinPeakDistance’,120);
% %AP = -AP;
% l_AP = numel (AP); %Number of AP
%
% %die Messwerte der Kraft in jeden Vorgang verteilen
% for i=1:l_AP;
% if (i<l_AP)
% K{i} = F_res(locs(i):locs(i+1));
% else
% K{i} = F_res(locs(i):end);
% end
% end
% RR=padcat(K{1,:}); %die L?nge der Kraft-Werte ausgleichen
% KL=nanmean(RR’); %Mittelwert berechnen
% sgf = sgolayfilt(KL,3,51); %Filter
%
% %die Messwerte der Winkel in jeden Vorgang verteilen
% for i=1:l_AP;
% if (i<l_AP)
% WW{i} = knie_w2(locs(i):locs(i+1));
% else
% WW{i} = knie_w2(locs(i):end);
% end
% end
%
% LL=padcat(WW{1,:}); %die L?nge der Winkel-Werte ausgleichen
% WL=nanmean(LL’); %Mittelwert berechnen
% sgf2 = sgolayfilt(WL,4,51); %Filter
%%
set(handles.checkbox1,’val’,1);
set(handles.checkbox6,’val’,1);
% checkbox1_Callback(hObject, eventdata, handles);
% imshow(mov(1).cdata);
% — Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2
cb1=get(handles.checkbox1,’val’);
cla;
close (figure(1));
if cb1==0
legend(‘off’);
else
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
axes(handles.axes1);
%% knie
hold on;
plot (sgolayfilt(knie_w2,3,51),’r’)
ylim([(min(knie_w2)-5) (max(knie_w2)+5)])
%%
xlabel(‘frame’);
ylabel(‘angle of knee extension in degree’);
legend(‘Winkel der Streckung’)
end
% Untitled2;
% — Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
global F_res knie_w2 P2 sgf sgf2
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb2==0
delete(P2);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
axes(handles.axes1);
%% Bandkraft
hold off;
P2 = plot (knie_w2,sgolayfilt(F_res,3,51),sgf2,sgf);
%%
xlabel(‘angle of knie extension in degree’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’,’Summation’)
% x_fir_h=plot(h4,’b’);
end
% for i=2:length(kurbel_w0_index)-1
%
% plot(kurbel_w0_index(i)-33,fres.h1(kurbel_w0_index(i)-2),’*’);
% endhandles
% Hint: get(hObject,’Value’) returns toggle state of checkbox2
legend_f(handles);
% — Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global F_res knie_w2 P3 sgf sgf2
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb3==0
delete(P3);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
%% Kniekraft
hold off;
P3 = plot (sgf2,sgf);
ylim([(min(sgf)-200) (max(sgf)+200)])
index = find(sgf==max(sgf));
txt = [‘max = ‘, num2str(max(sgf)),’ N’,’ ; ‘ num2str(sgf2(index)),’ Grad’];
text(sgf2(index)-15,max(sgf)+10,txt)
%%
xlabel(‘angle of knie extension in degree’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox3
% — Executes on button press in checkbox4.
function checkbox4_Callback(hObject, eventdata, handles)
% hObject handle to checkbox4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2 d3_l P4 sgf sgf2 L t
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb4==0
delete(P4);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
%% Berechnung der Winkel?nderung
%[min_sgf2,min_locs] = findpeaks((-1 * sgf2),’MinPeakDistance’,100);
%min_sgf2 = -1 * min_sgf2;
%findpeaks((-1 * sgf2),’MinPeakDistance’,100);
%
%for i = 1:length(sgf2)
% d_sgf2(i) = sgf2(i) – min_sgf2;
%end
%% Berechnung der Zeit
for i = 1:length(sgf)
t(i) = i*17/801;
end
% %% Berechnung der Leistung
% for i = min_locs:length(sgf)
% if d_sgf2(i) > 0
% P(i) = ((sgf(i) – sgf(min_locs)) * 2 * pi * L * d_sgf2 (i) / 360) / (t(i)-t(min_locs));
% else
% P(i) = NaN;
% end
% end
%% Streckungwinkel gegen Zeit
hold off;
P4 = plot (t,sgf2,’r’);
ylim([(min(sgf2)-5) (max(sgf2)+5)])
xlabel(‘time [s]’);
ylabel(‘angle of knie extension in degree’);
legend(‘Winkel der Streckung’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox4
% — Executes on button press in checkbox5.
function checkbox5_Callback(hObject, eventdata, handles)
% hObject handle to checkbox5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fx fz f_x f_r kurbel_w0_index kurbel_w
cb1=get(handles.checkbox1,’val’);
cb5=get(handles.checkbox5,’val’);
cla;
if cb1==1
close (figure(1)) ;
end
if cb5==0
cla;
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
% f_x=plot(fx, ‘m’);
% hold on
% f_z=plot(fz, ‘cyan’);
% f_r=plot(fr, ‘b’);
% hold on
% f_r=plot(fres.h1,’r’)
f_x=1:length(fx);
B = fir1(60,0.4);
% plot(h4,’r’)
% x_fir = filtfilt (B, 1, fr);
% hold on;
f_r=plot(f_x,fx,’b’,f_x,fz,’r’);
xlabel(‘Frame’);
ylabel(‘force in sensor [N]’);
legend(‘x-component’,’z-component’);
%
% cla;
% [a,b]= size(kurbel_w0_index);
% h2=zeros(length(kurbel_w0_index),359);
% h25=zeros(length(kurbel_w0_index),359);
% h26=zeros(length(kurbel_w0_index),359);
% for i=1:b-1
% j=kurbel_w0_index(i);
% % hold on
% % plot(kurbel_w(j:kurbel_w0_index(i+1)-1),fres.h1(j:kurbel_w0_index(i+1)-1))
%
% h3=fr(j:kurbel_w0_index(i+1)-1);
% h5=fx(j:kurbel_w0_index(i+1)-1);
% h6=fz(j:kurbel_w0_index(i+1)-1);
% fh(i).c=h3;
% fh5(i).c=h5;
% fh6(i).c=h6;
% h1=kurbel_w(j:kurbel_w0_index(i+1)-1);
% fh3(i).c=h1;
% % length(h1)
%
% for k=1:length(h3)
% kk=round(kurbel_w(j+k-1))-1;
% if kk<=0
% kk=1;
% end
% h2(i,kk)=(h3(k)+h2(kk));
% h25(i,kk)=(h5(k)+h25(kk));
% h26(i,kk)=(h6(k)+h26(kk));
%
% end
%
% end
%
% j=1;
% for i=1:length(h2)
% if i<21
% s1=h2(:,length(h2)-20+i:length(h2));
% s5=h25(:,length(h25)-20+i:length(h25));
% s6=h26(:,length(h26)-20+i:length(h26));
% s2=h2(:,1:i);
% s25=h25(:,1:i);
% s26=h26(:,1:i);
%
% s=[s1,s2];
% s55=[s5,s25];
% s66=[s6,s26];
% else
% s=h2(:,i-20:i);
% s55=h25(:,i-20:i);
% s66=h26(:,i-20:i);
% end
% s=s(s~=0);
% h4(i)=sum(s)/length(s);
% s55=s55(s55~=0);
% h45(i)=sum(s55)/length(s55);
% s66=s66(s66~=0);
% h46(i)=sum(s66)/length(s66);
%
% end
%
% h4(isnan(h4))=[];
% plot(h4)
% hold on
% h45(isnan(h45))=[];
% plot(h45,’r’)
% h6(isnan(h46))=[];
% plot(h46,’g’)
% % Hint: get(hObject,’Value’) returns toggle state of checkbox5
% legend(‘resultierende Pedal Kraft’,’z-Komponente’,’x-Komponente’);
end
% — Executes on button press in loeschen.
function loeschen_Callback(hObject, eventdata, handles)
% hObject handle to loeschen (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all;
% — Executes on button press in checkbox6.
function checkbox6_Callback(hObject, eventdata, handles)
% hObject handle to checkbox6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2 F_res P6 sgf sgf2 t d3_l
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb6==0
delete(P6);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
%% Berechnung der Zeit
for i = 1:length(sgf2)
t(i) = i*17/801;
end
%% res. Kniekraft gegen Zeit
hold off;
P6 = plot (t,sgf,’r’);
ylim([(min(sgf)-200) (max(sgf)+200)])
index = find(sgf==max(sgf));
txt = [‘max = ‘, num2str(max(sgf)),’ N’,’ ; ‘ num2str(t(index)),’ s’];
text(t(index)-0.20,max(sgf)+40,txt)
%%
xlabel(‘time [s]’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox4
% Hint: get(hObject,’Value’) returns toggle state of checkbox6
function legend_f(handles)
global x_fir_h x_fir_k x_fir_s
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb6=get(handles.checkbox6,’val’);
if cb6==1
i=1;
if cb2==1 && length(x_fir_h)==1
L{i}=’H?ftkraft’;
x_fir(i)=x_fir_h;
i=i+1;
end
if cb3==1 && length(x_fir_k)==1
L{i}=’Kniekraft’;
x_fir(i)=x_fir_k;
i=i+1;
end
if cb4==1 && length(x_fir_s)==1
L{i}=’Sprunggelenkkraft’;
x_fir(i)=x_fir_s;
i=i+1;
end
% Hint: get(hObject,’Value’) returns toggle state of checkbox6
if i>1
legend(x_fir,L);
end
end
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sgf sgf2 peaks_l peaks_v knie_w2 F_res cb1
%% Summation bestimmen
%Ausw?hlen min. bzw. max. Peaks durch -1 bzw. 1 Eingabe
% close (figure(2));
if isempty(peaks_l)==1
peaks_l={‘150’};
peaks_v={‘1’};
else
peaks_l={num2str(peaks_l)};
peaks_v={num2str(peaks_v)};
end
peaks_l=inputdlg({‘please enter peaks distance’},’peaksdistance’,1,peaks_l);
peaks_l=str2num(peaks_l{1});
peaks_v=inputdlg({‘max. peaks = 1 or min. peaks = -1′},’peaksvalue’,1,peaks_v);
peaks_v=str2num(peaks_v{1});
%Suchen die min. bzw max. Winkel-Werte
[AP, locs] = findpeaks(sgolayfilt(peaks_v * knie_w2,3,51),’MinPeakDistance’,peaks_l);
AP = peaks_v * AP;
l_AP = numel (AP); %Number of AP
%plotting findpeaks
% cla;
figure(2);
findpeaks(sgolayfilt(peaks_v * knie_w2,3,51),’MinPeakDistance’,peaks_l);
xlabel(‘frame’);
ylabel(‘angle of knee extension in degree’);
legend(‘Winkel der Streckung’)
%die Messwerte der Kraft in jeden Vorgang verteilen
for i=1:l_AP;
if (i<l_AP)
K{i} = F_res(locs(i):locs(i+1));
else
K{i} = F_res(locs(i):end);
end
end
RR=padcat(K{1,:}); %die L?nge der Kraft-Werte ausgleichen
KL=nanmean(RR’); %Mittelwert berechnen
sgf = sgolayfilt(KL,3,51); %Filter
%die Messwerte der Winkel in jeden Vorgang verteilen
for i=1:l_AP;
if (i<l_AP)
WW{i} = knie_w2(locs(i):locs(i+1));
else
WW{i} = knie_w2(locs(i):end);
end
end
LL=padcat(WW{1,:}); %die L?nge der Winkel-Werte ausgleichen
WL=nanmean(LL’); %Mittelwert berechnen
sgf2 = sgolayfilt(WL,4,51); %Filter
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sgf sgf2 t knie_w2 F_res
frame = (1:length(F_res))’;
kniekraft = F_res;
kniewinkel = knie_w2;
sum_zeit = t’;
sum_kniewinkel = sgf2′;
sum_kniekraft = sgf’;
% Get the name of the file that the user wants to save.
% Note, if you’re saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath; % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, ‘.xlsx’);
[baseFileName, folder] = uiputfile(defaultFileName, ‘Specify a file’);
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName);
Tab1 = table(frame,kniekraft,kniewinkel);
Tab2 = table (sum_zeit,sum_kniekraft,sum_kniewinkel);
%xlswrite(fullFileName, Tab1, ‘A1’)
%xlswrite(fullFileName, Tab2, ‘D1’)
writetable(Tab1,fullFileName);
writetable(Tab2,fullFileName,’Sheet’,1,’Range’,’D1′);
Unrecognized function or variable ‘nanmean’.
Error in Ausgabe>pushbutton4_Callback (line 675)
KL=nanmean(RR’); %Mittelwert berechnen
Error in gui_mainfcn (line 90)
feval(varargin{:});
Error in Ausgabe (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)Ausgabe(‘pushbutton4_Callback’,hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.function varargout = Ausgabe(varargin)
% AUSGABE MATLAB code for Ausgabe.fig
% AUSGABE, by itself, creates a new AUSGABE or raises the existing
% singleton*.
%
% H = AUSGABE returns the handle to a new AUSGABE or the handle to
% the existing singleton*.
%
% AUSGABE(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in AUSGABE.M with the given input arguments.
%
% AUSGABE(‘Property’,’Value’,…) creates a new AUSGABE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Ausgabe_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Ausgabe_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Ausgabe
% Last Modified by GUIDE v2.5 18-Jul-2019 11:15:33
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @Ausgabe_OpeningFcn, …
‘gui_OutputFcn’, @Ausgabe_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before Ausgabe is made visible.
function Ausgabe_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Ausgabe (see VARARGIN)
% Choose default command line output for Ausgabe
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Ausgabe wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = Ausgabe_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% — Executes on button press in Mark_pos.
function Mark_pos_Callback(hObject, eventdata, handles)
% hObject handle to Mark_pos (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global position pathname
uiwait(msgbox(‘please choose the Markerposition-Datei!’,’Achtung’,’modal’));
% [filename, pathname] = uigetfile( ‘*.mat’);
if isempty(pathname)==1
[filename, pathname] = uigetfile(‘*.mat’);
else
filename = uigetfile([pathname,’*.mat’]);
end
load(fullfile(pathname,filename));
p=position;
vid_lad_Callback(hObject, eventdata, handles);
% — Executes on button press in vid_lad.
function vid_lad_Callback(hObject, eventdata, handles)
% hObject handle to vid_lad (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global position sgf sgf2 h_w tetha_w alpha_w L knie_w knie_w2 d3_l sprung_w pedal_w kurbel_w fx fz F F_res beta_w beta_w2 fres kurbel_w0_index gew gew2 ho x0 y0 x1 y1 x2 y2
%% Winkelmessung
h=position.h;
knie=position.knie;
sprung=position.sprung;
fuss=position.fuss;
fx=position.kraftx(:,1);
fz=position.kraftz(:,1);
axes(handles.axes1);
%% Kniewinkelberechnungen
for i=1:length(h)
P0 = knie(i,:); %definieren Knie als Ursprungspunkt
P1 = h(i,:); %definieren H?ft als P1
P2 = sprung(i,:); %definieren Sprunggelenk als P1
n1 = (P2 – P0) / norm(P2 – P0); % Normalized vectors = Betr?g des Vektors
n2 = (P1 – P0) / norm(P1 – P0); % Normalized vectors = Betr?g des Vektors
knie_w(i) = acosd(dot(n1, n2)); % Kniewenkel
end
%%
%input Gewicht und L?nge des Unterschenkels
if isempty(gew)==1
gew={’95’};
gew2={‘5’};
L={‘0.4’};
else
gew={num2str(gew)};
gew2={num2str(gew2)};
L={num2str(L)};
end
gew=inputdlg({‘please enter body weight in kg’},’body weight’,1,gew);
gew=str2num(gew{1});
gew2=inputdlg({‘please enter weight plate in kg’},’weight’,1,gew2);
gew2=str2num(gew2{1});
L=inputdlg({‘please enter length of lower leg in m’},’length’,1,L);
L=str2num(L{1});
%% Variablen berechnen
%Patellarsehne-winkel berechnen
knie_w2 = knie_w’;
beta_w = -0.000012941919 .* (knie_w2 .^3) + 0.004613095238 .* (knie_w2 .^2) – 0.204942279942 .* knie_w2 – 14.142857142856;
beta_w2 = abs(beta_w);
%Winkel zwischen Tibia und y-Achse
alpha_w2 = knie_w2 – 90;
alpha_w = abs(alpha_w2);
%Winkel zwischen Femur und Patellarsehne-winkel
tetha_w = knie_w2 – beta_w;
%Hebel?rme
d1 = L * sind(alpha_w) * 0.43;
d2 = L * sind(alpha_w);
d3 = L / 5 * sind(beta_w2);
d3_l = (0.0000000002434 .* (knie_w2 .^6) – 0.0000001568469 .* (knie_w2 .^5) + 0.0000394291959 .* (knie_w2 .^4) – 0.0049457648343 .* (knie_w2 .^3) + 0.3289434274828 .* (knie_w2 .^2) – 11.0152767344929.* knie_w2 + 170.0411753969300) / 1000;
%Gewichte
gew_fuss = 5.3 / 100 * gew;
gew_last = gew2 + 6.853; %plus gewicht der Halterung 6.853 kg
%% Kr?fte Berechnen
%Bandkraft
F1 = (fx * (L – 0.05) + gew_fuss * 9.81 * d1 + gew_last * 9.81 * d2);
F = F1 ./ d3_l;
%Femoropatellarkraft
F_res = sqrt( 2 .* (F .^2) + 2 .* (F .^2) .* cosd (tetha_w));
% %% Berechnung der Mittelwerte
%
% %suchen die min. Winkel-Werte
% [AP, locs] = findpeaks(sgolayfilt(knie_w2,3,51),’MinPeakDistance’,120);
% %AP = -AP;
% l_AP = numel (AP); %Number of AP
%
% %die Messwerte der Kraft in jeden Vorgang verteilen
% for i=1:l_AP;
% if (i<l_AP)
% K{i} = F_res(locs(i):locs(i+1));
% else
% K{i} = F_res(locs(i):end);
% end
% end
% RR=padcat(K{1,:}); %die L?nge der Kraft-Werte ausgleichen
% KL=nanmean(RR’); %Mittelwert berechnen
% sgf = sgolayfilt(KL,3,51); %Filter
%
% %die Messwerte der Winkel in jeden Vorgang verteilen
% for i=1:l_AP;
% if (i<l_AP)
% WW{i} = knie_w2(locs(i):locs(i+1));
% else
% WW{i} = knie_w2(locs(i):end);
% end
% end
%
% LL=padcat(WW{1,:}); %die L?nge der Winkel-Werte ausgleichen
% WL=nanmean(LL’); %Mittelwert berechnen
% sgf2 = sgolayfilt(WL,4,51); %Filter
%%
set(handles.checkbox1,’val’,1);
set(handles.checkbox6,’val’,1);
% checkbox1_Callback(hObject, eventdata, handles);
% imshow(mov(1).cdata);
% — Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2
cb1=get(handles.checkbox1,’val’);
cla;
close (figure(1));
if cb1==0
legend(‘off’);
else
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
axes(handles.axes1);
%% knie
hold on;
plot (sgolayfilt(knie_w2,3,51),’r’)
ylim([(min(knie_w2)-5) (max(knie_w2)+5)])
%%
xlabel(‘frame’);
ylabel(‘angle of knee extension in degree’);
legend(‘Winkel der Streckung’)
end
% Untitled2;
% — Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
global F_res knie_w2 P2 sgf sgf2
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb2==0
delete(P2);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
axes(handles.axes1);
%% Bandkraft
hold off;
P2 = plot (knie_w2,sgolayfilt(F_res,3,51),sgf2,sgf);
%%
xlabel(‘angle of knie extension in degree’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’,’Summation’)
% x_fir_h=plot(h4,’b’);
end
% for i=2:length(kurbel_w0_index)-1
%
% plot(kurbel_w0_index(i)-33,fres.h1(kurbel_w0_index(i)-2),’*’);
% endhandles
% Hint: get(hObject,’Value’) returns toggle state of checkbox2
legend_f(handles);
% — Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global F_res knie_w2 P3 sgf sgf2
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb3==0
delete(P3);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
%% Kniekraft
hold off;
P3 = plot (sgf2,sgf);
ylim([(min(sgf)-200) (max(sgf)+200)])
index = find(sgf==max(sgf));
txt = [‘max = ‘, num2str(max(sgf)),’ N’,’ ; ‘ num2str(sgf2(index)),’ Grad’];
text(sgf2(index)-15,max(sgf)+10,txt)
%%
xlabel(‘angle of knie extension in degree’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox3
% — Executes on button press in checkbox4.
function checkbox4_Callback(hObject, eventdata, handles)
% hObject handle to checkbox4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2 d3_l P4 sgf sgf2 L t
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb4==0
delete(P4);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
%% Berechnung der Winkel?nderung
%[min_sgf2,min_locs] = findpeaks((-1 * sgf2),’MinPeakDistance’,100);
%min_sgf2 = -1 * min_sgf2;
%findpeaks((-1 * sgf2),’MinPeakDistance’,100);
%
%for i = 1:length(sgf2)
% d_sgf2(i) = sgf2(i) – min_sgf2;
%end
%% Berechnung der Zeit
for i = 1:length(sgf)
t(i) = i*17/801;
end
% %% Berechnung der Leistung
% for i = min_locs:length(sgf)
% if d_sgf2(i) > 0
% P(i) = ((sgf(i) – sgf(min_locs)) * 2 * pi * L * d_sgf2 (i) / 360) / (t(i)-t(min_locs));
% else
% P(i) = NaN;
% end
% end
%% Streckungwinkel gegen Zeit
hold off;
P4 = plot (t,sgf2,’r’);
ylim([(min(sgf2)-5) (max(sgf2)+5)])
xlabel(‘time [s]’);
ylabel(‘angle of knie extension in degree’);
legend(‘Winkel der Streckung’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox4
% — Executes on button press in checkbox5.
function checkbox5_Callback(hObject, eventdata, handles)
% hObject handle to checkbox5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fx fz f_x f_r kurbel_w0_index kurbel_w
cb1=get(handles.checkbox1,’val’);
cb5=get(handles.checkbox5,’val’);
cla;
if cb1==1
close (figure(1)) ;
end
if cb5==0
cla;
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
% f_x=plot(fx, ‘m’);
% hold on
% f_z=plot(fz, ‘cyan’);
% f_r=plot(fr, ‘b’);
% hold on
% f_r=plot(fres.h1,’r’)
f_x=1:length(fx);
B = fir1(60,0.4);
% plot(h4,’r’)
% x_fir = filtfilt (B, 1, fr);
% hold on;
f_r=plot(f_x,fx,’b’,f_x,fz,’r’);
xlabel(‘Frame’);
ylabel(‘force in sensor [N]’);
legend(‘x-component’,’z-component’);
%
% cla;
% [a,b]= size(kurbel_w0_index);
% h2=zeros(length(kurbel_w0_index),359);
% h25=zeros(length(kurbel_w0_index),359);
% h26=zeros(length(kurbel_w0_index),359);
% for i=1:b-1
% j=kurbel_w0_index(i);
% % hold on
% % plot(kurbel_w(j:kurbel_w0_index(i+1)-1),fres.h1(j:kurbel_w0_index(i+1)-1))
%
% h3=fr(j:kurbel_w0_index(i+1)-1);
% h5=fx(j:kurbel_w0_index(i+1)-1);
% h6=fz(j:kurbel_w0_index(i+1)-1);
% fh(i).c=h3;
% fh5(i).c=h5;
% fh6(i).c=h6;
% h1=kurbel_w(j:kurbel_w0_index(i+1)-1);
% fh3(i).c=h1;
% % length(h1)
%
% for k=1:length(h3)
% kk=round(kurbel_w(j+k-1))-1;
% if kk<=0
% kk=1;
% end
% h2(i,kk)=(h3(k)+h2(kk));
% h25(i,kk)=(h5(k)+h25(kk));
% h26(i,kk)=(h6(k)+h26(kk));
%
% end
%
% end
%
% j=1;
% for i=1:length(h2)
% if i<21
% s1=h2(:,length(h2)-20+i:length(h2));
% s5=h25(:,length(h25)-20+i:length(h25));
% s6=h26(:,length(h26)-20+i:length(h26));
% s2=h2(:,1:i);
% s25=h25(:,1:i);
% s26=h26(:,1:i);
%
% s=[s1,s2];
% s55=[s5,s25];
% s66=[s6,s26];
% else
% s=h2(:,i-20:i);
% s55=h25(:,i-20:i);
% s66=h26(:,i-20:i);
% end
% s=s(s~=0);
% h4(i)=sum(s)/length(s);
% s55=s55(s55~=0);
% h45(i)=sum(s55)/length(s55);
% s66=s66(s66~=0);
% h46(i)=sum(s66)/length(s66);
%
% end
%
% h4(isnan(h4))=[];
% plot(h4)
% hold on
% h45(isnan(h45))=[];
% plot(h45,’r’)
% h6(isnan(h46))=[];
% plot(h46,’g’)
% % Hint: get(hObject,’Value’) returns toggle state of checkbox5
% legend(‘resultierende Pedal Kraft’,’z-Komponente’,’x-Komponente’);
end
% — Executes on button press in loeschen.
function loeschen_Callback(hObject, eventdata, handles)
% hObject handle to loeschen (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all;
% — Executes on button press in checkbox6.
function checkbox6_Callback(hObject, eventdata, handles)
% hObject handle to checkbox6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2 F_res P6 sgf sgf2 t d3_l
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb6==0
delete(P6);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
%% Berechnung der Zeit
for i = 1:length(sgf2)
t(i) = i*17/801;
end
%% res. Kniekraft gegen Zeit
hold off;
P6 = plot (t,sgf,’r’);
ylim([(min(sgf)-200) (max(sgf)+200)])
index = find(sgf==max(sgf));
txt = [‘max = ‘, num2str(max(sgf)),’ N’,’ ; ‘ num2str(t(index)),’ s’];
text(t(index)-0.20,max(sgf)+40,txt)
%%
xlabel(‘time [s]’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox4
% Hint: get(hObject,’Value’) returns toggle state of checkbox6
function legend_f(handles)
global x_fir_h x_fir_k x_fir_s
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb6=get(handles.checkbox6,’val’);
if cb6==1
i=1;
if cb2==1 && length(x_fir_h)==1
L{i}=’H?ftkraft’;
x_fir(i)=x_fir_h;
i=i+1;
end
if cb3==1 && length(x_fir_k)==1
L{i}=’Kniekraft’;
x_fir(i)=x_fir_k;
i=i+1;
end
if cb4==1 && length(x_fir_s)==1
L{i}=’Sprunggelenkkraft’;
x_fir(i)=x_fir_s;
i=i+1;
end
% Hint: get(hObject,’Value’) returns toggle state of checkbox6
if i>1
legend(x_fir,L);
end
end
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sgf sgf2 peaks_l peaks_v knie_w2 F_res cb1
%% Summation bestimmen
%Ausw?hlen min. bzw. max. Peaks durch -1 bzw. 1 Eingabe
% close (figure(2));
if isempty(peaks_l)==1
peaks_l={‘150’};
peaks_v={‘1’};
else
peaks_l={num2str(peaks_l)};
peaks_v={num2str(peaks_v)};
end
peaks_l=inputdlg({‘please enter peaks distance’},’peaksdistance’,1,peaks_l);
peaks_l=str2num(peaks_l{1});
peaks_v=inputdlg({‘max. peaks = 1 or min. peaks = -1′},’peaksvalue’,1,peaks_v);
peaks_v=str2num(peaks_v{1});
%Suchen die min. bzw max. Winkel-Werte
[AP, locs] = findpeaks(sgolayfilt(peaks_v * knie_w2,3,51),’MinPeakDistance’,peaks_l);
AP = peaks_v * AP;
l_AP = numel (AP); %Number of AP
%plotting findpeaks
% cla;
figure(2);
findpeaks(sgolayfilt(peaks_v * knie_w2,3,51),’MinPeakDistance’,peaks_l);
xlabel(‘frame’);
ylabel(‘angle of knee extension in degree’);
legend(‘Winkel der Streckung’)
%die Messwerte der Kraft in jeden Vorgang verteilen
for i=1:l_AP;
if (i<l_AP)
K{i} = F_res(locs(i):locs(i+1));
else
K{i} = F_res(locs(i):end);
end
end
RR=padcat(K{1,:}); %die L?nge der Kraft-Werte ausgleichen
KL=nanmean(RR’); %Mittelwert berechnen
sgf = sgolayfilt(KL,3,51); %Filter
%die Messwerte der Winkel in jeden Vorgang verteilen
for i=1:l_AP;
if (i<l_AP)
WW{i} = knie_w2(locs(i):locs(i+1));
else
WW{i} = knie_w2(locs(i):end);
end
end
LL=padcat(WW{1,:}); %die L?nge der Winkel-Werte ausgleichen
WL=nanmean(LL’); %Mittelwert berechnen
sgf2 = sgolayfilt(WL,4,51); %Filter
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sgf sgf2 t knie_w2 F_res
frame = (1:length(F_res))’;
kniekraft = F_res;
kniewinkel = knie_w2;
sum_zeit = t’;
sum_kniewinkel = sgf2′;
sum_kniekraft = sgf’;
% Get the name of the file that the user wants to save.
% Note, if you’re saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath; % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, ‘.xlsx’);
[baseFileName, folder] = uiputfile(defaultFileName, ‘Specify a file’);
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName);
Tab1 = table(frame,kniekraft,kniewinkel);
Tab2 = table (sum_zeit,sum_kniekraft,sum_kniewinkel);
%xlswrite(fullFileName, Tab1, ‘A1’)
%xlswrite(fullFileName, Tab2, ‘D1’)
writetable(Tab1,fullFileName);
writetable(Tab2,fullFileName,’Sheet’,1,’Range’,’D1′);
Unrecognized function or variable ‘nanmean’.
Error in Ausgabe>pushbutton4_Callback (line 675)
KL=nanmean(RR’); %Mittelwert berechnen
Error in gui_mainfcn (line 90)
feval(varargin{:});
Error in Ausgabe (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)Ausgabe(‘pushbutton4_Callback’,hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback. function varargout = Ausgabe(varargin)
% AUSGABE MATLAB code for Ausgabe.fig
% AUSGABE, by itself, creates a new AUSGABE or raises the existing
% singleton*.
%
% H = AUSGABE returns the handle to a new AUSGABE or the handle to
% the existing singleton*.
%
% AUSGABE(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in AUSGABE.M with the given input arguments.
%
% AUSGABE(‘Property’,’Value’,…) creates a new AUSGABE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Ausgabe_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Ausgabe_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Ausgabe
% Last Modified by GUIDE v2.5 18-Jul-2019 11:15:33
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @Ausgabe_OpeningFcn, …
‘gui_OutputFcn’, @Ausgabe_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before Ausgabe is made visible.
function Ausgabe_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Ausgabe (see VARARGIN)
% Choose default command line output for Ausgabe
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Ausgabe wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = Ausgabe_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% — Executes on button press in Mark_pos.
function Mark_pos_Callback(hObject, eventdata, handles)
% hObject handle to Mark_pos (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global position pathname
uiwait(msgbox(‘please choose the Markerposition-Datei!’,’Achtung’,’modal’));
% [filename, pathname] = uigetfile( ‘*.mat’);
if isempty(pathname)==1
[filename, pathname] = uigetfile(‘*.mat’);
else
filename = uigetfile([pathname,’*.mat’]);
end
load(fullfile(pathname,filename));
p=position;
vid_lad_Callback(hObject, eventdata, handles);
% — Executes on button press in vid_lad.
function vid_lad_Callback(hObject, eventdata, handles)
% hObject handle to vid_lad (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global position sgf sgf2 h_w tetha_w alpha_w L knie_w knie_w2 d3_l sprung_w pedal_w kurbel_w fx fz F F_res beta_w beta_w2 fres kurbel_w0_index gew gew2 ho x0 y0 x1 y1 x2 y2
%% Winkelmessung
h=position.h;
knie=position.knie;
sprung=position.sprung;
fuss=position.fuss;
fx=position.kraftx(:,1);
fz=position.kraftz(:,1);
axes(handles.axes1);
%% Kniewinkelberechnungen
for i=1:length(h)
P0 = knie(i,:); %definieren Knie als Ursprungspunkt
P1 = h(i,:); %definieren H?ft als P1
P2 = sprung(i,:); %definieren Sprunggelenk als P1
n1 = (P2 – P0) / norm(P2 – P0); % Normalized vectors = Betr?g des Vektors
n2 = (P1 – P0) / norm(P1 – P0); % Normalized vectors = Betr?g des Vektors
knie_w(i) = acosd(dot(n1, n2)); % Kniewenkel
end
%%
%input Gewicht und L?nge des Unterschenkels
if isempty(gew)==1
gew={’95’};
gew2={‘5’};
L={‘0.4’};
else
gew={num2str(gew)};
gew2={num2str(gew2)};
L={num2str(L)};
end
gew=inputdlg({‘please enter body weight in kg’},’body weight’,1,gew);
gew=str2num(gew{1});
gew2=inputdlg({‘please enter weight plate in kg’},’weight’,1,gew2);
gew2=str2num(gew2{1});
L=inputdlg({‘please enter length of lower leg in m’},’length’,1,L);
L=str2num(L{1});
%% Variablen berechnen
%Patellarsehne-winkel berechnen
knie_w2 = knie_w’;
beta_w = -0.000012941919 .* (knie_w2 .^3) + 0.004613095238 .* (knie_w2 .^2) – 0.204942279942 .* knie_w2 – 14.142857142856;
beta_w2 = abs(beta_w);
%Winkel zwischen Tibia und y-Achse
alpha_w2 = knie_w2 – 90;
alpha_w = abs(alpha_w2);
%Winkel zwischen Femur und Patellarsehne-winkel
tetha_w = knie_w2 – beta_w;
%Hebel?rme
d1 = L * sind(alpha_w) * 0.43;
d2 = L * sind(alpha_w);
d3 = L / 5 * sind(beta_w2);
d3_l = (0.0000000002434 .* (knie_w2 .^6) – 0.0000001568469 .* (knie_w2 .^5) + 0.0000394291959 .* (knie_w2 .^4) – 0.0049457648343 .* (knie_w2 .^3) + 0.3289434274828 .* (knie_w2 .^2) – 11.0152767344929.* knie_w2 + 170.0411753969300) / 1000;
%Gewichte
gew_fuss = 5.3 / 100 * gew;
gew_last = gew2 + 6.853; %plus gewicht der Halterung 6.853 kg
%% Kr?fte Berechnen
%Bandkraft
F1 = (fx * (L – 0.05) + gew_fuss * 9.81 * d1 + gew_last * 9.81 * d2);
F = F1 ./ d3_l;
%Femoropatellarkraft
F_res = sqrt( 2 .* (F .^2) + 2 .* (F .^2) .* cosd (tetha_w));
% %% Berechnung der Mittelwerte
%
% %suchen die min. Winkel-Werte
% [AP, locs] = findpeaks(sgolayfilt(knie_w2,3,51),’MinPeakDistance’,120);
% %AP = -AP;
% l_AP = numel (AP); %Number of AP
%
% %die Messwerte der Kraft in jeden Vorgang verteilen
% for i=1:l_AP;
% if (i<l_AP)
% K{i} = F_res(locs(i):locs(i+1));
% else
% K{i} = F_res(locs(i):end);
% end
% end
% RR=padcat(K{1,:}); %die L?nge der Kraft-Werte ausgleichen
% KL=nanmean(RR’); %Mittelwert berechnen
% sgf = sgolayfilt(KL,3,51); %Filter
%
% %die Messwerte der Winkel in jeden Vorgang verteilen
% for i=1:l_AP;
% if (i<l_AP)
% WW{i} = knie_w2(locs(i):locs(i+1));
% else
% WW{i} = knie_w2(locs(i):end);
% end
% end
%
% LL=padcat(WW{1,:}); %die L?nge der Winkel-Werte ausgleichen
% WL=nanmean(LL’); %Mittelwert berechnen
% sgf2 = sgolayfilt(WL,4,51); %Filter
%%
set(handles.checkbox1,’val’,1);
set(handles.checkbox6,’val’,1);
% checkbox1_Callback(hObject, eventdata, handles);
% imshow(mov(1).cdata);
% — Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2
cb1=get(handles.checkbox1,’val’);
cla;
close (figure(1));
if cb1==0
legend(‘off’);
else
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
axes(handles.axes1);
%% knie
hold on;
plot (sgolayfilt(knie_w2,3,51),’r’)
ylim([(min(knie_w2)-5) (max(knie_w2)+5)])
%%
xlabel(‘frame’);
ylabel(‘angle of knee extension in degree’);
legend(‘Winkel der Streckung’)
end
% Untitled2;
% — Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
global F_res knie_w2 P2 sgf sgf2
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb2==0
delete(P2);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
axes(handles.axes1);
%% Bandkraft
hold off;
P2 = plot (knie_w2,sgolayfilt(F_res,3,51),sgf2,sgf);
%%
xlabel(‘angle of knie extension in degree’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’,’Summation’)
% x_fir_h=plot(h4,’b’);
end
% for i=2:length(kurbel_w0_index)-1
%
% plot(kurbel_w0_index(i)-33,fres.h1(kurbel_w0_index(i)-2),’*’);
% endhandles
% Hint: get(hObject,’Value’) returns toggle state of checkbox2
legend_f(handles);
% — Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global F_res knie_w2 P3 sgf sgf2
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb3==0
delete(P3);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
%% Kniekraft
hold off;
P3 = plot (sgf2,sgf);
ylim([(min(sgf)-200) (max(sgf)+200)])
index = find(sgf==max(sgf));
txt = [‘max = ‘, num2str(max(sgf)),’ N’,’ ; ‘ num2str(sgf2(index)),’ Grad’];
text(sgf2(index)-15,max(sgf)+10,txt)
%%
xlabel(‘angle of knie extension in degree’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox3
% — Executes on button press in checkbox4.
function checkbox4_Callback(hObject, eventdata, handles)
% hObject handle to checkbox4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2 d3_l P4 sgf sgf2 L t
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb4==0
delete(P4);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox5,’val’,0);
set(handles.checkbox6,’val’,0);
%% Berechnung der Winkel?nderung
%[min_sgf2,min_locs] = findpeaks((-1 * sgf2),’MinPeakDistance’,100);
%min_sgf2 = -1 * min_sgf2;
%findpeaks((-1 * sgf2),’MinPeakDistance’,100);
%
%for i = 1:length(sgf2)
% d_sgf2(i) = sgf2(i) – min_sgf2;
%end
%% Berechnung der Zeit
for i = 1:length(sgf)
t(i) = i*17/801;
end
% %% Berechnung der Leistung
% for i = min_locs:length(sgf)
% if d_sgf2(i) > 0
% P(i) = ((sgf(i) – sgf(min_locs)) * 2 * pi * L * d_sgf2 (i) / 360) / (t(i)-t(min_locs));
% else
% P(i) = NaN;
% end
% end
%% Streckungwinkel gegen Zeit
hold off;
P4 = plot (t,sgf2,’r’);
ylim([(min(sgf2)-5) (max(sgf2)+5)])
xlabel(‘time [s]’);
ylabel(‘angle of knie extension in degree’);
legend(‘Winkel der Streckung’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox4
% — Executes on button press in checkbox5.
function checkbox5_Callback(hObject, eventdata, handles)
% hObject handle to checkbox5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fx fz f_x f_r kurbel_w0_index kurbel_w
cb1=get(handles.checkbox1,’val’);
cb5=get(handles.checkbox5,’val’);
cla;
if cb1==1
close (figure(1)) ;
end
if cb5==0
cla;
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
% f_x=plot(fx, ‘m’);
% hold on
% f_z=plot(fz, ‘cyan’);
% f_r=plot(fr, ‘b’);
% hold on
% f_r=plot(fres.h1,’r’)
f_x=1:length(fx);
B = fir1(60,0.4);
% plot(h4,’r’)
% x_fir = filtfilt (B, 1, fr);
% hold on;
f_r=plot(f_x,fx,’b’,f_x,fz,’r’);
xlabel(‘Frame’);
ylabel(‘force in sensor [N]’);
legend(‘x-component’,’z-component’);
%
% cla;
% [a,b]= size(kurbel_w0_index);
% h2=zeros(length(kurbel_w0_index),359);
% h25=zeros(length(kurbel_w0_index),359);
% h26=zeros(length(kurbel_w0_index),359);
% for i=1:b-1
% j=kurbel_w0_index(i);
% % hold on
% % plot(kurbel_w(j:kurbel_w0_index(i+1)-1),fres.h1(j:kurbel_w0_index(i+1)-1))
%
% h3=fr(j:kurbel_w0_index(i+1)-1);
% h5=fx(j:kurbel_w0_index(i+1)-1);
% h6=fz(j:kurbel_w0_index(i+1)-1);
% fh(i).c=h3;
% fh5(i).c=h5;
% fh6(i).c=h6;
% h1=kurbel_w(j:kurbel_w0_index(i+1)-1);
% fh3(i).c=h1;
% % length(h1)
%
% for k=1:length(h3)
% kk=round(kurbel_w(j+k-1))-1;
% if kk<=0
% kk=1;
% end
% h2(i,kk)=(h3(k)+h2(kk));
% h25(i,kk)=(h5(k)+h25(kk));
% h26(i,kk)=(h6(k)+h26(kk));
%
% end
%
% end
%
% j=1;
% for i=1:length(h2)
% if i<21
% s1=h2(:,length(h2)-20+i:length(h2));
% s5=h25(:,length(h25)-20+i:length(h25));
% s6=h26(:,length(h26)-20+i:length(h26));
% s2=h2(:,1:i);
% s25=h25(:,1:i);
% s26=h26(:,1:i);
%
% s=[s1,s2];
% s55=[s5,s25];
% s66=[s6,s26];
% else
% s=h2(:,i-20:i);
% s55=h25(:,i-20:i);
% s66=h26(:,i-20:i);
% end
% s=s(s~=0);
% h4(i)=sum(s)/length(s);
% s55=s55(s55~=0);
% h45(i)=sum(s55)/length(s55);
% s66=s66(s66~=0);
% h46(i)=sum(s66)/length(s66);
%
% end
%
% h4(isnan(h4))=[];
% plot(h4)
% hold on
% h45(isnan(h45))=[];
% plot(h45,’r’)
% h6(isnan(h46))=[];
% plot(h46,’g’)
% % Hint: get(hObject,’Value’) returns toggle state of checkbox5
% legend(‘resultierende Pedal Kraft’,’z-Komponente’,’x-Komponente’);
end
% — Executes on button press in loeschen.
function loeschen_Callback(hObject, eventdata, handles)
% hObject handle to loeschen (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all;
% — Executes on button press in checkbox6.
function checkbox6_Callback(hObject, eventdata, handles)
% hObject handle to checkbox6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global knie_w2 F_res P6 sgf sgf2 t d3_l
cb1=get(handles.checkbox1,’val’);
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb5=get(handles.checkbox5,’val’);
cb6=get(handles.checkbox6,’val’);
if cb1==1 || cb5==1
cla;
close (figure(1)) ;
end
if cb6==0
delete(P6);
legend(‘off’);
else
set(handles.checkbox1,’val’,0);
set(handles.checkbox2,’val’,0);
set(handles.checkbox3,’val’,0);
set(handles.checkbox4,’val’,0);
set(handles.checkbox5,’val’,0);
%% Berechnung der Zeit
for i = 1:length(sgf2)
t(i) = i*17/801;
end
%% res. Kniekraft gegen Zeit
hold off;
P6 = plot (t,sgf,’r’);
ylim([(min(sgf)-200) (max(sgf)+200)])
index = find(sgf==max(sgf));
txt = [‘max = ‘, num2str(max(sgf)),’ N’,’ ; ‘ num2str(t(index)),’ s’];
text(t(index)-0.20,max(sgf)+40,txt)
%%
xlabel(‘time [s]’);
ylabel(‘force in knie joint [N]’);
legend(‘Kniekraft’)
end
legend_f(handles);
% Hint: get(hObject,’Value’) returns toggle state of checkbox4
% Hint: get(hObject,’Value’) returns toggle state of checkbox6
function legend_f(handles)
global x_fir_h x_fir_k x_fir_s
cb2=get(handles.checkbox2,’val’);
cb3=get(handles.checkbox3,’val’);
cb4=get(handles.checkbox4,’val’);
cb6=get(handles.checkbox6,’val’);
if cb6==1
i=1;
if cb2==1 && length(x_fir_h)==1
L{i}=’H?ftkraft’;
x_fir(i)=x_fir_h;
i=i+1;
end
if cb3==1 && length(x_fir_k)==1
L{i}=’Kniekraft’;
x_fir(i)=x_fir_k;
i=i+1;
end
if cb4==1 && length(x_fir_s)==1
L{i}=’Sprunggelenkkraft’;
x_fir(i)=x_fir_s;
i=i+1;
end
% Hint: get(hObject,’Value’) returns toggle state of checkbox6
if i>1
legend(x_fir,L);
end
end
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sgf sgf2 peaks_l peaks_v knie_w2 F_res cb1
%% Summation bestimmen
%Ausw?hlen min. bzw. max. Peaks durch -1 bzw. 1 Eingabe
% close (figure(2));
if isempty(peaks_l)==1
peaks_l={‘150’};
peaks_v={‘1’};
else
peaks_l={num2str(peaks_l)};
peaks_v={num2str(peaks_v)};
end
peaks_l=inputdlg({‘please enter peaks distance’},’peaksdistance’,1,peaks_l);
peaks_l=str2num(peaks_l{1});
peaks_v=inputdlg({‘max. peaks = 1 or min. peaks = -1′},’peaksvalue’,1,peaks_v);
peaks_v=str2num(peaks_v{1});
%Suchen die min. bzw max. Winkel-Werte
[AP, locs] = findpeaks(sgolayfilt(peaks_v * knie_w2,3,51),’MinPeakDistance’,peaks_l);
AP = peaks_v * AP;
l_AP = numel (AP); %Number of AP
%plotting findpeaks
% cla;
figure(2);
findpeaks(sgolayfilt(peaks_v * knie_w2,3,51),’MinPeakDistance’,peaks_l);
xlabel(‘frame’);
ylabel(‘angle of knee extension in degree’);
legend(‘Winkel der Streckung’)
%die Messwerte der Kraft in jeden Vorgang verteilen
for i=1:l_AP;
if (i<l_AP)
K{i} = F_res(locs(i):locs(i+1));
else
K{i} = F_res(locs(i):end);
end
end
RR=padcat(K{1,:}); %die L?nge der Kraft-Werte ausgleichen
KL=nanmean(RR’); %Mittelwert berechnen
sgf = sgolayfilt(KL,3,51); %Filter
%die Messwerte der Winkel in jeden Vorgang verteilen
for i=1:l_AP;
if (i<l_AP)
WW{i} = knie_w2(locs(i):locs(i+1));
else
WW{i} = knie_w2(locs(i):end);
end
end
LL=padcat(WW{1,:}); %die L?nge der Winkel-Werte ausgleichen
WL=nanmean(LL’); %Mittelwert berechnen
sgf2 = sgolayfilt(WL,4,51); %Filter
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sgf sgf2 t knie_w2 F_res
frame = (1:length(F_res))’;
kniekraft = F_res;
kniewinkel = knie_w2;
sum_zeit = t’;
sum_kniewinkel = sgf2′;
sum_kniekraft = sgf’;
% Get the name of the file that the user wants to save.
% Note, if you’re saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath; % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, ‘.xlsx’);
[baseFileName, folder] = uiputfile(defaultFileName, ‘Specify a file’);
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName);
Tab1 = table(frame,kniekraft,kniewinkel);
Tab2 = table (sum_zeit,sum_kniekraft,sum_kniewinkel);
%xlswrite(fullFileName, Tab1, ‘A1’)
%xlswrite(fullFileName, Tab2, ‘D1’)
writetable(Tab1,fullFileName);
writetable(Tab2,fullFileName,’Sheet’,1,’Range’,’D1′);
Unrecognized function or variable ‘nanmean’.
Error in Ausgabe>pushbutton4_Callback (line 675)
KL=nanmean(RR’); %Mittelwert berechnen
Error in gui_mainfcn (line 90)
feval(varargin{:});
Error in Ausgabe (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)Ausgabe(‘pushbutton4_Callback’,hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback. gui MATLAB Answers — New Questions
Transfer Function of a RLC circuit 2 loop
how i can get a Transfer Function of a RLC circuit 2 loop if i want the output currenthow i can get a Transfer Function of a RLC circuit 2 loop if i want the output current how i can get a Transfer Function of a RLC circuit 2 loop if i want the output current transfer function of a rlc circuit 2 loop MATLAB Answers — New Questions
Numerical method to solve matric for eigen values of matrix (the input of matrix is an array)?
Data1 = readtable(‘D:VIT PHDWork 3 _ Exceptional SensingCST FilesAeiphi.xlsx’);
T1=table2array(Data1);
freq = T1(:,2); % Frequency (in THz)
txx = T1(:,3); % Amplitude of Co-Polarozation XX
P1 = T1(:,4); % Phase of Co-Polarozation XX
tyy = T1(:,5); % Amplitude of Co-Polarozation YY
P2 = T1(:,6); % Phase of Co-Polarozation YY
txy = T1(:,7); % Amplitude of Cross-Polarozation XY
P3 = T1(:,8); % Phase of Cross-Polarozation XY
tyx = T1(:,9); % Amplitude of Cross-Polarozation YX
P4 = T1(:,10); % Phase of Cross-Polarozation YX
T_XX = txx.*exp(1i.*P1); % Transmittance of co – polarozation of XX
T_YY = tyy.*exp(1i.*P2); % Transmittance of co – polarizarion of yy
T_XY = txy.*exp(1i.*P3); % Transmittance of cross polarization of xy
T_YX = tyx.*exp(1i.*P4); % Transmittance of cross polarization of yx
TT = table(T_XX,T_YY,T_XY,T_YX);
%%%% Eigen Matrix
ii = 1:1:1002;
n = length(ii);
for i = 1:n
T = [T_XX(i,1), T_XY(i,1); T_YX(i,1), T_YY(i,1)]; % Eigen Matrix for each frequency
E = eig(T); % Eigen Values
val = [E(1,1), E(2,1)]; % Reordering the Matrix
E1(i,1) = val(:,1); % Eigen Value 1
E2(i,1) = val(:,2); % Eigen value 2
ii=ii+1;
ES1(:,1) = real(E1(:,1));
ES2(:,1) = real(E2(:,1));
ephi1(:,1) = imag(E1(:,1));
ephi2(:,1) = imag(E2(:,1));
end
%% From eigen values separate real and imaginary part.
% (Real part: Transmission coffecient, Imaginary part: Phase)
a = abs(ES1);
b = abs(ES2);
c = ephi1;
d = ephi2;
T2 = table(a,b,c,d)
figure
plot(freq,a) % Plot of freq vs real eigen value 1 and 2
plot(freq,b)
ylim([0 1])
plot(freq,ephi1,freq,ephi2) % Plot of freq vs imag eigen value 1 and 2
ylim([-0.6 0.6])Data1 = readtable(‘D:VIT PHDWork 3 _ Exceptional SensingCST FilesAeiphi.xlsx’);
T1=table2array(Data1);
freq = T1(:,2); % Frequency (in THz)
txx = T1(:,3); % Amplitude of Co-Polarozation XX
P1 = T1(:,4); % Phase of Co-Polarozation XX
tyy = T1(:,5); % Amplitude of Co-Polarozation YY
P2 = T1(:,6); % Phase of Co-Polarozation YY
txy = T1(:,7); % Amplitude of Cross-Polarozation XY
P3 = T1(:,8); % Phase of Cross-Polarozation XY
tyx = T1(:,9); % Amplitude of Cross-Polarozation YX
P4 = T1(:,10); % Phase of Cross-Polarozation YX
T_XX = txx.*exp(1i.*P1); % Transmittance of co – polarozation of XX
T_YY = tyy.*exp(1i.*P2); % Transmittance of co – polarizarion of yy
T_XY = txy.*exp(1i.*P3); % Transmittance of cross polarization of xy
T_YX = tyx.*exp(1i.*P4); % Transmittance of cross polarization of yx
TT = table(T_XX,T_YY,T_XY,T_YX);
%%%% Eigen Matrix
ii = 1:1:1002;
n = length(ii);
for i = 1:n
T = [T_XX(i,1), T_XY(i,1); T_YX(i,1), T_YY(i,1)]; % Eigen Matrix for each frequency
E = eig(T); % Eigen Values
val = [E(1,1), E(2,1)]; % Reordering the Matrix
E1(i,1) = val(:,1); % Eigen Value 1
E2(i,1) = val(:,2); % Eigen value 2
ii=ii+1;
ES1(:,1) = real(E1(:,1));
ES2(:,1) = real(E2(:,1));
ephi1(:,1) = imag(E1(:,1));
ephi2(:,1) = imag(E2(:,1));
end
%% From eigen values separate real and imaginary part.
% (Real part: Transmission coffecient, Imaginary part: Phase)
a = abs(ES1);
b = abs(ES2);
c = ephi1;
d = ephi2;
T2 = table(a,b,c,d)
figure
plot(freq,a) % Plot of freq vs real eigen value 1 and 2
plot(freq,b)
ylim([0 1])
plot(freq,ephi1,freq,ephi2) % Plot of freq vs imag eigen value 1 and 2
ylim([-0.6 0.6]) Data1 = readtable(‘D:VIT PHDWork 3 _ Exceptional SensingCST FilesAeiphi.xlsx’);
T1=table2array(Data1);
freq = T1(:,2); % Frequency (in THz)
txx = T1(:,3); % Amplitude of Co-Polarozation XX
P1 = T1(:,4); % Phase of Co-Polarozation XX
tyy = T1(:,5); % Amplitude of Co-Polarozation YY
P2 = T1(:,6); % Phase of Co-Polarozation YY
txy = T1(:,7); % Amplitude of Cross-Polarozation XY
P3 = T1(:,8); % Phase of Cross-Polarozation XY
tyx = T1(:,9); % Amplitude of Cross-Polarozation YX
P4 = T1(:,10); % Phase of Cross-Polarozation YX
T_XX = txx.*exp(1i.*P1); % Transmittance of co – polarozation of XX
T_YY = tyy.*exp(1i.*P2); % Transmittance of co – polarizarion of yy
T_XY = txy.*exp(1i.*P3); % Transmittance of cross polarization of xy
T_YX = tyx.*exp(1i.*P4); % Transmittance of cross polarization of yx
TT = table(T_XX,T_YY,T_XY,T_YX);
%%%% Eigen Matrix
ii = 1:1:1002;
n = length(ii);
for i = 1:n
T = [T_XX(i,1), T_XY(i,1); T_YX(i,1), T_YY(i,1)]; % Eigen Matrix for each frequency
E = eig(T); % Eigen Values
val = [E(1,1), E(2,1)]; % Reordering the Matrix
E1(i,1) = val(:,1); % Eigen Value 1
E2(i,1) = val(:,2); % Eigen value 2
ii=ii+1;
ES1(:,1) = real(E1(:,1));
ES2(:,1) = real(E2(:,1));
ephi1(:,1) = imag(E1(:,1));
ephi2(:,1) = imag(E2(:,1));
end
%% From eigen values separate real and imaginary part.
% (Real part: Transmission coffecient, Imaginary part: Phase)
a = abs(ES1);
b = abs(ES2);
c = ephi1;
d = ephi2;
T2 = table(a,b,c,d)
figure
plot(freq,a) % Plot of freq vs real eigen value 1 and 2
plot(freq,b)
ylim([0 1])
plot(freq,ephi1,freq,ephi2) % Plot of freq vs imag eigen value 1 and 2
ylim([-0.6 0.6]) eigen values MATLAB Answers — New Questions
Webread Query Not Working
I am looking to query a forum style page (this forum, actually), but cannot seem to the the queries working as desired.
My goal is to essentially get the most viewed questions about Simulink (as woud be done via this page: https://www.mathworks.com/matlabcentral/answers/?product_base_code%5B%5D=Simulink&sort=views+desc)
However, when I try this via webread, the page I get is just the base Answers page, and it isn’t giving me Simulink, nor the sorting.
I am using the following (where indexed will be looped for multiple pages):
url = ‘https://www.mathworks.com/matlabcentral/answers/’;
data = webread(url,’page’, index,’product_base_code%5B%5D’,’Simulink’,’sort’,’views+desc’);
Any advice/help would be greatly appreciated.
Thanks!I am looking to query a forum style page (this forum, actually), but cannot seem to the the queries working as desired.
My goal is to essentially get the most viewed questions about Simulink (as woud be done via this page: https://www.mathworks.com/matlabcentral/answers/?product_base_code%5B%5D=Simulink&sort=views+desc)
However, when I try this via webread, the page I get is just the base Answers page, and it isn’t giving me Simulink, nor the sorting.
I am using the following (where indexed will be looped for multiple pages):
url = ‘https://www.mathworks.com/matlabcentral/answers/’;
data = webread(url,’page’, index,’product_base_code%5B%5D’,’Simulink’,’sort’,’views+desc’);
Any advice/help would be greatly appreciated.
Thanks! I am looking to query a forum style page (this forum, actually), but cannot seem to the the queries working as desired.
My goal is to essentially get the most viewed questions about Simulink (as woud be done via this page: https://www.mathworks.com/matlabcentral/answers/?product_base_code%5B%5D=Simulink&sort=views+desc)
However, when I try this via webread, the page I get is just the base Answers page, and it isn’t giving me Simulink, nor the sorting.
I am using the following (where indexed will be looped for multiple pages):
url = ‘https://www.mathworks.com/matlabcentral/answers/’;
data = webread(url,’page’, index,’product_base_code%5B%5D’,’Simulink’,’sort’,’views+desc’);
Any advice/help would be greatly appreciated.
Thanks! webread MATLAB Answers — New Questions
How to evaluate a fistree designed with the new addition to the app?
Hello,
How can I import and evaluate a fistree designed in the new addition of the FuzzyLogic Toolbox app?
It is saved as .mat file instead of .fis.
Readfis and load do not seem to work to import it to my script. I want to give inputs via evalfis, but it does not seem to work with the .mat file. It seems that it is not recognized as fistree.
Many thanks in advanceHello,
How can I import and evaluate a fistree designed in the new addition of the FuzzyLogic Toolbox app?
It is saved as .mat file instead of .fis.
Readfis and load do not seem to work to import it to my script. I want to give inputs via evalfis, but it does not seem to work with the .mat file. It seems that it is not recognized as fistree.
Many thanks in advance Hello,
How can I import and evaluate a fistree designed in the new addition of the FuzzyLogic Toolbox app?
It is saved as .mat file instead of .fis.
Readfis and load do not seem to work to import it to my script. I want to give inputs via evalfis, but it does not seem to work with the .mat file. It seems that it is not recognized as fistree.
Many thanks in advance fuzzy logic, fuzzy logic toolbox, fistree, evalfis, readfis MATLAB Answers — New Questions
Cannot save model:Error An error occurred during a callback while saving ‘D:untitled.slx’.
I am unable to save the model, which occasionally occurs. Does anyone know why?
An error occurred during a callback while saving ‘D:untitled.slx’.
The previously saved version of this file (if any) has not
been changed.
****
ErrorI am unable to save the model, which occasionally occurs. Does anyone know why?
An error occurred during a callback while saving ‘D:untitled.slx’.
The previously saved version of this file (if any) has not
been changed.
****
Error I am unable to save the model, which occasionally occurs. Does anyone know why?
An error occurred during a callback while saving ‘D:untitled.slx’.
The previously saved version of this file (if any) has not
been changed.
****
Error simulink MATLAB Answers — New Questions
InsstallMathWorksServiceHost: error while loading sharedl libraries
Running MATLAB 2024a on Ubuntu24.04 with concurrent network license. Insttallation diretory is local and owned by root. Home directory is NFS v3 mount.
When starting MATLAB the following messages appear in the console. MATLAB appears to function okay.
/home/nmrbox/gweatherby/.MathWorks/ServiceHost/matlab1/_tmp_MSHI_d1af-ba0c-9c00-df21/mci/_tempinstaller_glnxa64/bin/glnxa64/InstallMathWorksServiceHost: error while loading shared libraries: /home/nmrbox/gweatherby/.MathWorks/ServiceHost/matlab1/_tmp_MSHI_d1af-ba0c-9c00-df21/mci/_tempinstaller_glnxa64/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: file too shortRunning MATLAB 2024a on Ubuntu24.04 with concurrent network license. Insttallation diretory is local and owned by root. Home directory is NFS v3 mount.
When starting MATLAB the following messages appear in the console. MATLAB appears to function okay.
/home/nmrbox/gweatherby/.MathWorks/ServiceHost/matlab1/_tmp_MSHI_d1af-ba0c-9c00-df21/mci/_tempinstaller_glnxa64/bin/glnxa64/InstallMathWorksServiceHost: error while loading shared libraries: /home/nmrbox/gweatherby/.MathWorks/ServiceHost/matlab1/_tmp_MSHI_d1af-ba0c-9c00-df21/mci/_tempinstaller_glnxa64/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: file too short Running MATLAB 2024a on Ubuntu24.04 with concurrent network license. Insttallation diretory is local and owned by root. Home directory is NFS v3 mount.
When starting MATLAB the following messages appear in the console. MATLAB appears to function okay.
/home/nmrbox/gweatherby/.MathWorks/ServiceHost/matlab1/_tmp_MSHI_d1af-ba0c-9c00-df21/mci/_tempinstaller_glnxa64/bin/glnxa64/InstallMathWorksServiceHost: error while loading shared libraries: /home/nmrbox/gweatherby/.MathWorks/ServiceHost/matlab1/_tmp_MSHI_d1af-ba0c-9c00-df21/mci/_tempinstaller_glnxa64/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: file too short installation, servciehost MATLAB Answers — New Questions
Comparison of excel sheet data and output should be excel sheet for matched and mismatched data using simulink model.
I have two excel sheets, Data1 and Data2. I need to compare both the excel sheet and atlast I need to get excel sheet as an output for matched data and mismatched data using simulink model. Tell me how to read the excel sheet, compare it and and how to get the excel sheet as an output?I have two excel sheets, Data1 and Data2. I need to compare both the excel sheet and atlast I need to get excel sheet as an output for matched data and mismatched data using simulink model. Tell me how to read the excel sheet, compare it and and how to get the excel sheet as an output? I have two excel sheets, Data1 and Data2. I need to compare both the excel sheet and atlast I need to get excel sheet as an output for matched data and mismatched data using simulink model. Tell me how to read the excel sheet, compare it and and how to get the excel sheet as an output? function model MATLAB Answers — New Questions
Find the ratio or difference spectra as time progresses
Hi, I have a number of spectra that has been collected over a certain number of hours. How do I compute the difference spectra or ratio spectra over that time period? So say spectrum 1 is rationed with spectrum 2, spectrum 3 rationed with spectrum 2 etc. can same be done with difference spectrum as well? Any algorithm to do this? Thank you.Hi, I have a number of spectra that has been collected over a certain number of hours. How do I compute the difference spectra or ratio spectra over that time period? So say spectrum 1 is rationed with spectrum 2, spectrum 3 rationed with spectrum 2 etc. can same be done with difference spectrum as well? Any algorithm to do this? Thank you. Hi, I have a number of spectra that has been collected over a certain number of hours. How do I compute the difference spectra or ratio spectra over that time period? So say spectrum 1 is rationed with spectrum 2, spectrum 3 rationed with spectrum 2 etc. can same be done with difference spectrum as well? Any algorithm to do this? Thank you. matlab MATLAB Answers — New Questions
How to split my EMG signal into individual cycles?
Hi I have recorded an emg signal of 5 different muscles on someone performing manual wheelchair propulsion.
Sensor 1 = biceps
Sensor 2 = triceps
Sensor 3 = Anterioir Deltoid
Sensor 4 = Posterior Deltoid
Sensor 5 = Upper Trapezius
Each sensor also records the acceleration in the x, y and z directions.
I want to split the emg signal into seperate propulsion cycles (when the hand pushes and releases to when the hand hits the push rim again.) so that I can average each cycle, as well as convert time (s) to percentage of cycle.
I know there were 13-14 cycles during the recording as i videoed the subject while gathering data.
I have only looked at the bicep data as shown below and was wondeing if there is a way to do this with the information I have.
Please let me know if you need anymore information.
%% SEMG Signal Analysis – Row Test 1 Participant 1 28/06/2024
% *This is my practice code to figure out how to export the data into MATLAB and transfer the data into arrays that I can manipulate and do calculations with. *
clear all;
clc;
%% Importing raw data from csv. file
% *BOLD TEXT*
raw_data = readmatrix(‘P02_S09_T01.csv’);
%% SEMG Time Data
% *Storing the Sub-frame data in arrays*
fs = 1926; % sampling frequency in Hz
columnIndex = 2; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Sub_Frame = []; % Creating an array to store all the sub-frames related to the EMG data
row = 4;
while ~isnan(raw_data(row, columnIndex))
number = raw_data(row, columnIndex);
Sub_Frame = [Sub_Frame, number];
row = row + 1;
end
Time = (1:length(Sub_Frame))/fs; % converting the sub frame array into time in seconds array
%% Acceleration Sensor 1 (bicep) ACCY1
%
% Find the maximum row number
maxRow = size(raw_data, 1);
acc_fs = 148; %sa/sec
%find sub frame for acceleration
columnIndex = 2; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Acc_Sub_Frame = []; % Creating an array to store all the sub-frames related to the EMG data
acc_row = 77955;
while acc_row <= maxRow
number = raw_data(acc_row, columnIndex);
Acc_Sub_Frame = [Acc_Sub_Frame, number];
acc_row = acc_row + 1;
end
Acc_Time = (1:length(Acc_Sub_Frame))/acc_fs; % converting the sub frame array into time in seconds array
columnIndex4 = 4; % Corresponds to ACCY1 (acceleration in the y-direction of sensor 1).
ACCY1 = []; % Creating an array to store all the AccY1
row2 = 77955;
while row2 <= maxRow
num = raw_data(row2, columnIndex4);
ACCY1 = [ACCY1, num];
row2 = row2 + 1;
end
acc_rms_signal = [];
window = 50;
acc_rms_signal = sqrt(movmean((ACCY1.^2),window));
%% Muscle arrays
% Sensor #1 – Biceps Brachii
% Sensor #2 – Triceps Brachii
% Sensor #3 – Anterioir Deltoid
% Sensor #4 – Posterior Deltoid
% Sensor #5 – Upper Trapezius
% *Storing the muscle data in arrays*
columnIndex = 3; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Biceps_Brachii = [];% Creating an array to store all the frames related to the EMG data
row = 4; % This is the starting position of the Frame data
% Create a for loop to run through every sensor and store in each array.
while ~isnan(raw_data(row, columnIndex))
number = raw_data(row, columnIndex);
Biceps_Brachii = [Biceps_Brachii, number];
row = row + 1;
end
%% BP filter
% filtering from 20 to Hz
fnyq = fs/2;
fcuthigh = 20;
fcutlow = 450;
%4th order Butterworth BP filter
[b,a]=butter(4,[fcuthigh,fcutlow]/fnyq,’bandpass’);
butterworth_filter_signal=filtfilt(b,a,Biceps_Brachii);
%% RMS
%
rms_signal = [];
window = 50;
rms_signal = sqrt(movmean((rec_signal.^2),window));
% Create a figure with two subplots
figure;
% Plot the first graph on the top
subplot(2, 1, 1);
plot(Time, rms_signal);
title(‘EMG’);
% Plot the second graph on the bottom
subplot(2, 1, 2);
plot(Acc_Time, acc_rms_signal);
title(‘Acceleration’);Hi I have recorded an emg signal of 5 different muscles on someone performing manual wheelchair propulsion.
Sensor 1 = biceps
Sensor 2 = triceps
Sensor 3 = Anterioir Deltoid
Sensor 4 = Posterior Deltoid
Sensor 5 = Upper Trapezius
Each sensor also records the acceleration in the x, y and z directions.
I want to split the emg signal into seperate propulsion cycles (when the hand pushes and releases to when the hand hits the push rim again.) so that I can average each cycle, as well as convert time (s) to percentage of cycle.
I know there were 13-14 cycles during the recording as i videoed the subject while gathering data.
I have only looked at the bicep data as shown below and was wondeing if there is a way to do this with the information I have.
Please let me know if you need anymore information.
%% SEMG Signal Analysis – Row Test 1 Participant 1 28/06/2024
% *This is my practice code to figure out how to export the data into MATLAB and transfer the data into arrays that I can manipulate and do calculations with. *
clear all;
clc;
%% Importing raw data from csv. file
% *BOLD TEXT*
raw_data = readmatrix(‘P02_S09_T01.csv’);
%% SEMG Time Data
% *Storing the Sub-frame data in arrays*
fs = 1926; % sampling frequency in Hz
columnIndex = 2; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Sub_Frame = []; % Creating an array to store all the sub-frames related to the EMG data
row = 4;
while ~isnan(raw_data(row, columnIndex))
number = raw_data(row, columnIndex);
Sub_Frame = [Sub_Frame, number];
row = row + 1;
end
Time = (1:length(Sub_Frame))/fs; % converting the sub frame array into time in seconds array
%% Acceleration Sensor 1 (bicep) ACCY1
%
% Find the maximum row number
maxRow = size(raw_data, 1);
acc_fs = 148; %sa/sec
%find sub frame for acceleration
columnIndex = 2; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Acc_Sub_Frame = []; % Creating an array to store all the sub-frames related to the EMG data
acc_row = 77955;
while acc_row <= maxRow
number = raw_data(acc_row, columnIndex);
Acc_Sub_Frame = [Acc_Sub_Frame, number];
acc_row = acc_row + 1;
end
Acc_Time = (1:length(Acc_Sub_Frame))/acc_fs; % converting the sub frame array into time in seconds array
columnIndex4 = 4; % Corresponds to ACCY1 (acceleration in the y-direction of sensor 1).
ACCY1 = []; % Creating an array to store all the AccY1
row2 = 77955;
while row2 <= maxRow
num = raw_data(row2, columnIndex4);
ACCY1 = [ACCY1, num];
row2 = row2 + 1;
end
acc_rms_signal = [];
window = 50;
acc_rms_signal = sqrt(movmean((ACCY1.^2),window));
%% Muscle arrays
% Sensor #1 – Biceps Brachii
% Sensor #2 – Triceps Brachii
% Sensor #3 – Anterioir Deltoid
% Sensor #4 – Posterior Deltoid
% Sensor #5 – Upper Trapezius
% *Storing the muscle data in arrays*
columnIndex = 3; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Biceps_Brachii = [];% Creating an array to store all the frames related to the EMG data
row = 4; % This is the starting position of the Frame data
% Create a for loop to run through every sensor and store in each array.
while ~isnan(raw_data(row, columnIndex))
number = raw_data(row, columnIndex);
Biceps_Brachii = [Biceps_Brachii, number];
row = row + 1;
end
%% BP filter
% filtering from 20 to Hz
fnyq = fs/2;
fcuthigh = 20;
fcutlow = 450;
%4th order Butterworth BP filter
[b,a]=butter(4,[fcuthigh,fcutlow]/fnyq,’bandpass’);
butterworth_filter_signal=filtfilt(b,a,Biceps_Brachii);
%% RMS
%
rms_signal = [];
window = 50;
rms_signal = sqrt(movmean((rec_signal.^2),window));
% Create a figure with two subplots
figure;
% Plot the first graph on the top
subplot(2, 1, 1);
plot(Time, rms_signal);
title(‘EMG’);
% Plot the second graph on the bottom
subplot(2, 1, 2);
plot(Acc_Time, acc_rms_signal);
title(‘Acceleration’); Hi I have recorded an emg signal of 5 different muscles on someone performing manual wheelchair propulsion.
Sensor 1 = biceps
Sensor 2 = triceps
Sensor 3 = Anterioir Deltoid
Sensor 4 = Posterior Deltoid
Sensor 5 = Upper Trapezius
Each sensor also records the acceleration in the x, y and z directions.
I want to split the emg signal into seperate propulsion cycles (when the hand pushes and releases to when the hand hits the push rim again.) so that I can average each cycle, as well as convert time (s) to percentage of cycle.
I know there were 13-14 cycles during the recording as i videoed the subject while gathering data.
I have only looked at the bicep data as shown below and was wondeing if there is a way to do this with the information I have.
Please let me know if you need anymore information.
%% SEMG Signal Analysis – Row Test 1 Participant 1 28/06/2024
% *This is my practice code to figure out how to export the data into MATLAB and transfer the data into arrays that I can manipulate and do calculations with. *
clear all;
clc;
%% Importing raw data from csv. file
% *BOLD TEXT*
raw_data = readmatrix(‘P02_S09_T01.csv’);
%% SEMG Time Data
% *Storing the Sub-frame data in arrays*
fs = 1926; % sampling frequency in Hz
columnIndex = 2; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Sub_Frame = []; % Creating an array to store all the sub-frames related to the EMG data
row = 4;
while ~isnan(raw_data(row, columnIndex))
number = raw_data(row, columnIndex);
Sub_Frame = [Sub_Frame, number];
row = row + 1;
end
Time = (1:length(Sub_Frame))/fs; % converting the sub frame array into time in seconds array
%% Acceleration Sensor 1 (bicep) ACCY1
%
% Find the maximum row number
maxRow = size(raw_data, 1);
acc_fs = 148; %sa/sec
%find sub frame for acceleration
columnIndex = 2; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Acc_Sub_Frame = []; % Creating an array to store all the sub-frames related to the EMG data
acc_row = 77955;
while acc_row <= maxRow
number = raw_data(acc_row, columnIndex);
Acc_Sub_Frame = [Acc_Sub_Frame, number];
acc_row = acc_row + 1;
end
Acc_Time = (1:length(Acc_Sub_Frame))/acc_fs; % converting the sub frame array into time in seconds array
columnIndex4 = 4; % Corresponds to ACCY1 (acceleration in the y-direction of sensor 1).
ACCY1 = []; % Creating an array to store all the AccY1
row2 = 77955;
while row2 <= maxRow
num = raw_data(row2, columnIndex4);
ACCY1 = [ACCY1, num];
row2 = row2 + 1;
end
acc_rms_signal = [];
window = 50;
acc_rms_signal = sqrt(movmean((ACCY1.^2),window));
%% Muscle arrays
% Sensor #1 – Biceps Brachii
% Sensor #2 – Triceps Brachii
% Sensor #3 – Anterioir Deltoid
% Sensor #4 – Posterior Deltoid
% Sensor #5 – Upper Trapezius
% *Storing the muscle data in arrays*
columnIndex = 3; % Specify the index of the column you want to extract (1 for the Frame column, 2 for the Sub Frame column, and so on)
Biceps_Brachii = [];% Creating an array to store all the frames related to the EMG data
row = 4; % This is the starting position of the Frame data
% Create a for loop to run through every sensor and store in each array.
while ~isnan(raw_data(row, columnIndex))
number = raw_data(row, columnIndex);
Biceps_Brachii = [Biceps_Brachii, number];
row = row + 1;
end
%% BP filter
% filtering from 20 to Hz
fnyq = fs/2;
fcuthigh = 20;
fcutlow = 450;
%4th order Butterworth BP filter
[b,a]=butter(4,[fcuthigh,fcutlow]/fnyq,’bandpass’);
butterworth_filter_signal=filtfilt(b,a,Biceps_Brachii);
%% RMS
%
rms_signal = [];
window = 50;
rms_signal = sqrt(movmean((rec_signal.^2),window));
% Create a figure with two subplots
figure;
% Plot the first graph on the top
subplot(2, 1, 1);
plot(Time, rms_signal);
title(‘EMG’);
% Plot the second graph on the bottom
subplot(2, 1, 2);
plot(Acc_Time, acc_rms_signal);
title(‘Acceleration’); emg, cycle, signal processing MATLAB Answers — New Questions
how can i access to the export button on the architecture views of the system composer, using code?
I want to access the "export" button that is in the toolstrip of the architecture view tab, through code. Is it possible that with code or some function, I can export a view as if I had pressed the "export" button?
I have tried creating a report, but the images of the view are bad quality, it does not get the same quality and page orientation as if i clicked the export button.I want to access the "export" button that is in the toolstrip of the architecture view tab, through code. Is it possible that with code or some function, I can export a view as if I had pressed the "export" button?
I have tried creating a report, but the images of the view are bad quality, it does not get the same quality and page orientation as if i clicked the export button. I want to access the "export" button that is in the toolstrip of the architecture view tab, through code. Is it possible that with code or some function, I can export a view as if I had pressed the "export" button?
I have tried creating a report, but the images of the view are bad quality, it does not get the same quality and page orientation as if i clicked the export button. export, button, architecture views MATLAB Answers — New Questions
What does gca mean?
hello together, I’m a Beginner and I have a friends’ skript and I’m trying to understand it.
1.)I don’t really understand the "set"/"get" programmation als well as the "gca"/the "1" in the first line…
2.) Furthermore I didn’t understand what the:
{it t}
stands for (last line)…
for a Diagramm he wrote:
set(gca,’XGrid’,’on’, ‘YGrid’, ‘on’, ‘Fontsize’, 16, ‘linewidth’, 1)
x_axis = get(gca, ‘xtik’);
xlabel(‘time{it t} [s]’)
I’ve already been searching for this question, but too many other questions without any correlation to this theme were found…
Thanks!hello together, I’m a Beginner and I have a friends’ skript and I’m trying to understand it.
1.)I don’t really understand the "set"/"get" programmation als well as the "gca"/the "1" in the first line…
2.) Furthermore I didn’t understand what the:
{it t}
stands for (last line)…
for a Diagramm he wrote:
set(gca,’XGrid’,’on’, ‘YGrid’, ‘on’, ‘Fontsize’, 16, ‘linewidth’, 1)
x_axis = get(gca, ‘xtik’);
xlabel(‘time{it t} [s]’)
I’ve already been searching for this question, but too many other questions without any correlation to this theme were found…
Thanks! hello together, I’m a Beginner and I have a friends’ skript and I’m trying to understand it.
1.)I don’t really understand the "set"/"get" programmation als well as the "gca"/the "1" in the first line…
2.) Furthermore I didn’t understand what the:
{it t}
stands for (last line)…
for a Diagramm he wrote:
set(gca,’XGrid’,’on’, ‘YGrid’, ‘on’, ‘Fontsize’, 16, ‘linewidth’, 1)
x_axis = get(gca, ‘xtik’);
xlabel(‘time{it t} [s]’)
I’ve already been searching for this question, but too many other questions without any correlation to this theme were found…
Thanks! set, get, gca MATLAB Answers — New Questions
Compiled exe app doesn’t work on a function used within another function
So I have an app developed by MATLAB app designer. I have put my main backend code in a function and call that function on button press.
Here is my problem: While running in app designer everything is fine, but when I compile it as a stand-alone exe file and install it, the code doesn’t work properly. So I used messages in different parts of code to debug it and I find out that it stops as soon as it reaches first function used in the main function. Here is a demonstration of my main code, note that this is the main function called by app designer:
function maincode
x = 1;
y = 2;
z = secondfunction(x,y);
end
and my secondfunction is saved in another .m file (which I include in additional files before packaging)
function [sum] = maincode(first,second)
sum = first + second;
endSo I have an app developed by MATLAB app designer. I have put my main backend code in a function and call that function on button press.
Here is my problem: While running in app designer everything is fine, but when I compile it as a stand-alone exe file and install it, the code doesn’t work properly. So I used messages in different parts of code to debug it and I find out that it stops as soon as it reaches first function used in the main function. Here is a demonstration of my main code, note that this is the main function called by app designer:
function maincode
x = 1;
y = 2;
z = secondfunction(x,y);
end
and my secondfunction is saved in another .m file (which I include in additional files before packaging)
function [sum] = maincode(first,second)
sum = first + second;
end So I have an app developed by MATLAB app designer. I have put my main backend code in a function and call that function on button press.
Here is my problem: While running in app designer everything is fine, but when I compile it as a stand-alone exe file and install it, the code doesn’t work properly. So I used messages in different parts of code to debug it and I find out that it stops as soon as it reaches first function used in the main function. Here is a demonstration of my main code, note that this is the main function called by app designer:
function maincode
x = 1;
y = 2;
z = secondfunction(x,y);
end
and my secondfunction is saved in another .m file (which I include in additional files before packaging)
function [sum] = maincode(first,second)
sum = first + second;
end app designer, compiler, standalone, exe, function MATLAB Answers — New Questions
How to plot one curve and change color according to value
The tricky thing is that I get an attribute with the values and would like to have this part in the plot in a different color:
x = linspace(0,10);
y = sin(3*x).*exp(0.5*x);
c = find(y > 25);
m(length(x)) = 0;
m(c) = 1;
figure;
plot(x, y, ‘b’)
Where m becomes 1 the color should be red, else blue.
Can someone find the easiest way to do this?The tricky thing is that I get an attribute with the values and would like to have this part in the plot in a different color:
x = linspace(0,10);
y = sin(3*x).*exp(0.5*x);
c = find(y > 25);
m(length(x)) = 0;
m(c) = 1;
figure;
plot(x, y, ‘b’)
Where m becomes 1 the color should be red, else blue.
Can someone find the easiest way to do this? The tricky thing is that I get an attribute with the values and would like to have this part in the plot in a different color:
x = linspace(0,10);
y = sin(3*x).*exp(0.5*x);
c = find(y > 25);
m(length(x)) = 0;
m(c) = 1;
figure;
plot(x, y, ‘b’)
Where m becomes 1 the color should be red, else blue.
Can someone find the easiest way to do this? plot, changing color MATLAB Answers — New Questions
Source code for solving second order PDE using PINN
Hi
Can someone share the matlab source code for solving second order ODE of the type as below?
I could build a sample code using : https://uk.mathworks.com/help/deeplearning/ug/solve-partial-differential-equations-with-lbfgs-method-and-deep-learning.html#responsive_offcanvas
But, I am not sure how to input the IC of the form d/dx() in the code.
All help will be appreciated.
ThanksHi
Can someone share the matlab source code for solving second order ODE of the type as below?
I could build a sample code using : https://uk.mathworks.com/help/deeplearning/ug/solve-partial-differential-equations-with-lbfgs-method-and-deep-learning.html#responsive_offcanvas
But, I am not sure how to input the IC of the form d/dx() in the code.
All help will be appreciated.
Thanks Hi
Can someone share the matlab source code for solving second order ODE of the type as below?
I could build a sample code using : https://uk.mathworks.com/help/deeplearning/ug/solve-partial-differential-equations-with-lbfgs-method-and-deep-learning.html#responsive_offcanvas
But, I am not sure how to input the IC of the form d/dx() in the code.
All help will be appreciated.
Thanks pinn MATLAB Answers — New Questions
Nondimensionalizing Length and Temp data from 2-D Ansys Transient thermal in Matlab
I have a text file that has dimensionalized data from Ansys (in micron and Kelvin). The first column is length and the second column is temperature. I am trying to nondimensionalize these data points and then put them in a graph where the x-axis represents nondimensionalized length and the y-axis represends nondimensionalized temperature.
xs = 100µm
Tf = 500K
Ti = 300K
How do I nondimensionalize this properly?I have a text file that has dimensionalized data from Ansys (in micron and Kelvin). The first column is length and the second column is temperature. I am trying to nondimensionalize these data points and then put them in a graph where the x-axis represents nondimensionalized length and the y-axis represends nondimensionalized temperature.
xs = 100µm
Tf = 500K
Ti = 300K
How do I nondimensionalize this properly? I have a text file that has dimensionalized data from Ansys (in micron and Kelvin). The first column is length and the second column is temperature. I am trying to nondimensionalize these data points and then put them in a graph where the x-axis represents nondimensionalized length and the y-axis represends nondimensionalized temperature.
xs = 100µm
Tf = 500K
Ti = 300K
How do I nondimensionalize this properly? nondimensionalize, matlab, text file, data, temperature, length, graph MATLAB Answers — New Questions
Solving trigonometric simultaneous equations
Is it possible to solve when the equations are little complex? For example lets’s take an inverse kinematics problem. Where we get,
-0.2595 0.5536 0.7913 0.3004 r11 r12 r13 o1
-0.7781 -0.6052 0.1682 0.0639 = r21 r22 r23 o2
0.5721 -0.5721 0.5878 0.6167 r31 r32 r33 o3
0 0 0 1 0 0 0 0
each of these symbols represents a trigonometric function such as below. Need to find θ1,θ2,θ3,θ4,θ5
[ sin(theta1)*sin(theta5) – cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)) + sin(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2))), cos(theta5)*sin(theta1) + sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)) + sin(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2))), cos(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2)) – sin(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)), (1143*cos(theta1)*cos(theta2))/5000 + (127*cos(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2)))/1600 – (127*sin(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)))/1600 – (1143*cos(theta1)*sin(theta2)*sin(theta3))/5000 + (1143*cos(theta1)*cos(theta2)*cos(theta3))/5000]
[ – cos(theta1)*sin(theta5) – cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)) + sin(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2))), sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)) + sin(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2))) – cos(theta1)*cos(theta5), cos(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2)) – sin(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)), (1143*cos(theta2)*sin(theta1))/5000 + (127*cos(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2)))/1600 – (127*sin(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)))/1600 – (1143*sin(theta1)*sin(theta2)*sin(theta3))/5000 + (1143*cos(theta2)*cos(theta3)*sin(theta1))/5000]
[ cos(theta5)*(cos(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + sin(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3))), -sin(theta5)*(cos(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + sin(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3))), sin(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) – cos(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3)), (1143*sin(theta2))/5000 + (1143*cos(theta2)*sin(theta3))/5000 + (1143*cos(theta3)*sin(theta2))/5000 – (127*cos(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3)))/1600 + (127*sin(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)))/1600 + 4953/20000]
[ 0, 0, 0, 1]
Is matlab capable of solving such equations?
Thank you.Is it possible to solve when the equations are little complex? For example lets’s take an inverse kinematics problem. Where we get,
-0.2595 0.5536 0.7913 0.3004 r11 r12 r13 o1
-0.7781 -0.6052 0.1682 0.0639 = r21 r22 r23 o2
0.5721 -0.5721 0.5878 0.6167 r31 r32 r33 o3
0 0 0 1 0 0 0 0
each of these symbols represents a trigonometric function such as below. Need to find θ1,θ2,θ3,θ4,θ5
[ sin(theta1)*sin(theta5) – cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)) + sin(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2))), cos(theta5)*sin(theta1) + sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)) + sin(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2))), cos(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2)) – sin(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)), (1143*cos(theta1)*cos(theta2))/5000 + (127*cos(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2)))/1600 – (127*sin(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)))/1600 – (1143*cos(theta1)*sin(theta2)*sin(theta3))/5000 + (1143*cos(theta1)*cos(theta2)*cos(theta3))/5000]
[ – cos(theta1)*sin(theta5) – cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)) + sin(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2))), sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)) + sin(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2))) – cos(theta1)*cos(theta5), cos(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2)) – sin(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)), (1143*cos(theta2)*sin(theta1))/5000 + (127*cos(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2)))/1600 – (127*sin(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)))/1600 – (1143*sin(theta1)*sin(theta2)*sin(theta3))/5000 + (1143*cos(theta2)*cos(theta3)*sin(theta1))/5000]
[ cos(theta5)*(cos(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + sin(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3))), -sin(theta5)*(cos(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + sin(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3))), sin(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) – cos(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3)), (1143*sin(theta2))/5000 + (1143*cos(theta2)*sin(theta3))/5000 + (1143*cos(theta3)*sin(theta2))/5000 – (127*cos(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3)))/1600 + (127*sin(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)))/1600 + 4953/20000]
[ 0, 0, 0, 1]
Is matlab capable of solving such equations?
Thank you. Is it possible to solve when the equations are little complex? For example lets’s take an inverse kinematics problem. Where we get,
-0.2595 0.5536 0.7913 0.3004 r11 r12 r13 o1
-0.7781 -0.6052 0.1682 0.0639 = r21 r22 r23 o2
0.5721 -0.5721 0.5878 0.6167 r31 r32 r33 o3
0 0 0 1 0 0 0 0
each of these symbols represents a trigonometric function such as below. Need to find θ1,θ2,θ3,θ4,θ5
[ sin(theta1)*sin(theta5) – cos(theta5)*(cos(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)) + sin(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2))), cos(theta5)*sin(theta1) + sin(theta5)*(cos(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)) + sin(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2))), cos(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2)) – sin(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)), (1143*cos(theta1)*cos(theta2))/5000 + (127*cos(theta4)*(cos(theta1)*cos(theta2)*sin(theta3) + cos(theta1)*cos(theta3)*sin(theta2)))/1600 – (127*sin(theta4)*(cos(theta1)*sin(theta2)*sin(theta3) – cos(theta1)*cos(theta2)*cos(theta3)))/1600 – (1143*cos(theta1)*sin(theta2)*sin(theta3))/5000 + (1143*cos(theta1)*cos(theta2)*cos(theta3))/5000]
[ – cos(theta1)*sin(theta5) – cos(theta5)*(cos(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)) + sin(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2))), sin(theta5)*(cos(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)) + sin(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2))) – cos(theta1)*cos(theta5), cos(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2)) – sin(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)), (1143*cos(theta2)*sin(theta1))/5000 + (127*cos(theta4)*(cos(theta2)*sin(theta1)*sin(theta3) + cos(theta3)*sin(theta1)*sin(theta2)))/1600 – (127*sin(theta4)*(sin(theta1)*sin(theta2)*sin(theta3) – cos(theta2)*cos(theta3)*sin(theta1)))/1600 – (1143*sin(theta1)*sin(theta2)*sin(theta3))/5000 + (1143*cos(theta2)*cos(theta3)*sin(theta1))/5000]
[ cos(theta5)*(cos(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + sin(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3))), -sin(theta5)*(cos(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + sin(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3))), sin(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) – cos(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3)), (1143*sin(theta2))/5000 + (1143*cos(theta2)*sin(theta3))/5000 + (1143*cos(theta3)*sin(theta2))/5000 – (127*cos(theta4)*(cos(theta2)*cos(theta3) – sin(theta2)*sin(theta3)))/1600 + (127*sin(theta4)*(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)))/1600 + 4953/20000]
[ 0, 0, 0, 1]
Is matlab capable of solving such equations?
Thank you. solve MATLAB Answers — New Questions
Can’t find vehicleDatasetImages.zip
I’m trying to use the dataset ‘vehicleDatasetImages’, but the function unzip returns this error:
Error using matlab.io.internal.archive.checkFilename>throwFileNotFoundError (line 156)
Function UNZIP was unable to find file ”vehicleDatasetImages.zip”.
What can I do?I’m trying to use the dataset ‘vehicleDatasetImages’, but the function unzip returns this error:
Error using matlab.io.internal.archive.checkFilename>throwFileNotFoundError (line 156)
Function UNZIP was unable to find file ”vehicleDatasetImages.zip”.
What can I do? I’m trying to use the dataset ‘vehicleDatasetImages’, but the function unzip returns this error:
Error using matlab.io.internal.archive.checkFilename>throwFileNotFoundError (line 156)
Function UNZIP was unable to find file ”vehicleDatasetImages.zip”.
What can I do? data, deep learning, object detection MATLAB Answers — New Questions