Memuat
Memuat
Support Vector Machine (fitcsvm) for Robotics and Mechatronics
0 views
Build an SVM model to predict the terrain surface type from the vibration rms and mean motor current features on synthetic data. fitcsvm trains a Support Vector Machine for binary classification with various kernels. It suits classification on small to medium data with complex class boundaries.

Build an SVM model to predict the terrain surface type from the vibration rms and mean motor current features on synthetic data.
| Role | Variable | Unit |
|---|---|---|
| Main | Terrain surface type | - |
| Supporting 1 | Vibration rms | m/s² |
| Supporting 2 | Mean motor current | A |
The RBF-kernel SVM classifies Terrain surface type with a test accuracy of 0.877 and F1 of 0.894 using 63 support vectors; the best cross-validated accuracy of 0.930 occurs at C=1.00.
Computed from illustrative synthetic data, not from a real study.
fitcsvm trains a Support Vector Machine for binary classification with various kernels. It suits classification on small to medium data with complex class boundaries.
Report the kernel, hyperparameters, test metrics, and the number of support vectors. Acknowledge the limited interpretability of a black-box model.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
rng(6);
n = 300;
vibration_rms = randn(n, 2);
terrain_surface_type = double(sum(vibration_rms.^2, 2) > 1.4); % circular class boundary
cv = cvpartition(terrain_surface_type, 'HoldOut', 0.25);
Xtr = vibration_rms(training(cv), :); ytr = terrain_surface_type(training(cv));
Xte = vibration_rms(test(cv), :); yte = terrain_surface_type(test(cv));
best = inf;
for C = [0.1 1 10 100]
m = fitcsvm(Xtr, ytr, 'KernelFunction', 'rbf', 'KernelScale', 'auto', ...
'BoxConstraint', C, 'Standardize', true);
err = kfoldLoss(crossval(m, 'KFold', 5));
if err < best, best = err; Cbest = C; end
end
mdl = fitcsvm(Xtr, ytr, 'KernelFunction', 'rbf', 'KernelScale', 'auto', ...
'BoxConstraint', Cbest, 'Standardize', true);
[pred, score] = predict(mdl, Xte);
[~, ~, ~, auc] = perfcurve(yte, score(:, 2), 1);
fprintf('Best C = %g, CV error = %.3f\n', Cbest, best);
fprintf('Test accuracy = %.3f, AUC = %.3f, support vectors = %d\n', mean(pred == yte), auc, sum(mdl.IsSupportVector));
disp(confusionmat(yte, pred));
[g1, g2] = meshgrid(linspace(-3, 3, 150));
gp = predict(mdl, [g1(:) g2(:)]);
figure; gscatter(g1(:), g2(:), gp, [0.9 0.9 1; 1 0.9 0.9]); hold on;
gscatter(Xte(:,1), Xte(:,2), yte, 'br', 'ox');
xlabel('x_1'); ylabel('x_2'); title('SVM decision regions');Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$25
excl. 11% VAT
Duration: 5 working days
Output: MATLAB files + result figures
Deliverables
Package 2 · most chosen
US$69
excl. 11% VAT
Duration: 9 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$150
excl. 11% VAT
Duration: 14-17 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Support Vector Machine (fitcsvm) is commonly used at this level in Robotics and Mechatronics. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output MATLAB gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$25, Package 2 (your data analysis and interpretation) US$69 and Package 3 (full guidance) US$150, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. MATLAB is a trademark of The MathWorks, Inc.
Back to MATLAB portfolio