Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I want to enter the data into MATLAB Workspace as MATLAB variables (e.g. left_sp

ID: 1831917 • Letter: I

Question

I want to enter the data into MATLAB Workspace as MATLAB variables (e.g. left_speed, right_pulsewidth) and save the results to a .mat file using the save command.

 

Also generate plot.

 

The following are my code, but something wrong with it. I don't know why. Could any help me with it??

 

The error message,

 ??? Error using ==> load
Unable to read MAT-file
C:Users.........data.mat:
not a binary MAT-file.
Try LOAD -ASCII to read as text.

 

This is my data.mat file:
x = 1.3:0.01:1.7;
l = [-29 -28 -27.5 -26 -24.5 -23.5 -23 -21 -19 -17.5 -15 -14 -11 -7.5 -6 -1 -0.8 -0.2 0 0 0 0 0 0 0 0.01 0.1 1 1 6 6.5 10 12.5 14.5 16 17.5 19 21 22 23 25];
r = [-25.5 -24.5 -24 -22.5 -20.5 -20 -19 -18 -16 -14.5 -12 -10.5 -9 -5.2 -3.3 -1.6 -1 -0.2 0 0 0 0 0 0 0 0.1 1 2 5.5 7.5 9 12 13.3 15 17 18 20.5 22 22.5 23.3 25];
save data.mat x l r

 


This is my m-script file,
pulsewidth = load('data','x');
left_speed = load('data','l');
right_speed = load('data','r');


figure
subplot (2,1,1)
plot(pulsewidth,left_speed,'-r^','LineWidth',2,'MarkerEdgeColor','b')
xlabel('Pulse Width (ms)','FontSize',16);
ylabel('CW   Motor RPM   CCW','FontSize',16);
title('Left Motor','FontSize',16)
grid on

subplot(2,1,2)
plot(pulsewidth,right_speed,'-rs','LineWidth',2,'MarkerEdgeColor','b')
xlabel('Pulse Width (ms)','FontSize',16);
ylabel('CW   Motor RPM   CCW','FontSize',16);
title('Right Motor','FontSize',16)
grid on


orient tall

Explanation / Answer

i got it .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote