Hello, if someone could please help. I was instructed to plot this data as a series of data points and not a solid line.

1 回表示 (過去 30 日間)
if true
% code
end
close all
clear all
clc
StepDownData = importdata('Exercise ADXL345_Micro_3.txt');
delimiterIn = ', ';
time_ms = StepDownData(:,1);
bits = StepDownData(:,2);
bits = bits-1; % adjusts to zero reading of the accelerometer
t = time_ms./1000000;
accel = bits./6.57; %counts/m/s2
plot(accel);
xlimits = [866,2000];
xlim(xlimits);
xlabel 'index'
ylabel 'acceleration (m/s^2)'
title 'Response with ADXL 345'

採用された回答

Star Strider
Star Strider 2018 年 5 月 16 日
Include a marker argument to plot:
plot(accel, '.');
although if ‘t’ and ‘accel’ are the same size, this would be preferable:
plot(t, accel, '.');
See the documentation for plot for details.
  2 件のコメント
Charles Naegele
Charles Naegele 2018 年 5 月 16 日
The marker argument worked. I guess t and accel are not the same size, the plot came up empty. Thank you

サインインしてコメントする。

その他の回答 (1 件)

Kyle Ruzic
Kyle Ruzic 2018 年 5 月 16 日
編集済み: Kyle Ruzic 2018 年 5 月 16 日
As long as you are loading your data file correctly, all you need to change is the function
plot(accel);
to
scatter(t, accel);

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by