最近用matlab实时数据采集采集数据遇到一个问题,求助

Matlab数据处理中遇到的两个小问题
已有 3256 次阅读
|系统分类:|关键词:matlab detrend 删除列
版本R2012a Unix1. 去趋势化函数去趋势化函数detrend对一列和对一个矩阵处理的结果有差异,但是其说明里说是对矩阵每一列进行处理: & &Y = detrend(X) removes the best straight-line fit linear trend from the & &data in vector X and returns the residual in vector Y. &If X is a & &matrix, detrend removes the trend from each column of the matrix.& & &Y = detrend(X,'constant') removes just the mean value from the vector X, & &or the mean value from each column, if X is a matrix. & & & &Y = detrend(X,'linear',BP) removes a continuous, piecewise linear trend. & &Breakpoint indices for the linear trend are contained in the vector BP. & &The default is no breakpoints, such that one single straight line is & &removed from each column of X.最后一句很可疑,难道是所有的列都移除了同样的一条直线?那么这条直线必然是全局拟合出来的了。看来保险起见,还是用一次处理一列为好,虽然速度上慢了很多。2.一次删除掉两列的速度比分两一次每次分别删除掉一列的速度要慢任务是要做循环,每次把从原矩阵取值特定的列到一个矩阵,使得这个矩阵比原矩阵少两列。可以直接赋值,需要改变索引,这样速度居然最慢;还可以先反原矩阵全赋值给这个矩阵,再从这个矩阵里删除两列。奇怪的是从这个矩阵里删除两列,居然一次删除两列比分两次每次删一列要慢上一些!
转载本文请联系原作者获取授权,同时请注明本文来自王龙飞科学网博客。链接地址:
上一篇:下一篇:
当前推荐数:0
评论 ( 个评论)
扫一扫,分享此博文
作者的其他最新博文
热门博文导读
Powered by
Copyright &查看: 2821|回复: 4
大家好,用STM32采集到的数据如图所示,想在matlab上做波形显示和频谱分析,幅值有了,但时间点不知该从哪里取得?求指教
主题帖子精华
初级会员, 积分 104, 距离下一级还需 96 积分
在线时间0 小时
大家好,用STM32采集到的数据如下所示,想在matlab上做波形显示和频谱分析,幅值有了,但时间点不知该从哪里取得?求指教
d3fd88c7d5f94_700.jpg (0 Bytes, 下载次数: 0)
22:54 上传
附加信息:28Hz的信号,用定时器实现一周期采集256个点(7.168KHz),ADC的采样频率(转换速率)为72M/6/252=47.619kHz,用DMA发送,串口波特率为115200,如何获得采样的时间点?因为串口得到的一周期的采样个数82个小于256个,所以采样的时间点不知从何处算起?求大神指教,谢谢!
主题帖子精华
金钱115675
在线时间874 小时
既然一个周期是256个点,为何串口只得到82个?
我是开源电子网站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺:
微信公众平台:正点原子& &
主题帖子精华
初级会员, 积分 104, 距离下一级还需 96 积分
在线时间0 小时
原子哥,这确实是个问题,我怀疑是不是延时的原因?我改成一个周期采集32个点,分别用查询法和DMA进行发送至串口调试助手,结果在串口调试助手里均不能得到32个周期点。
1、DAM不加延时
& & & temp=adcx*100*(3.3/4096);
& & & SendBuff[0]=temp/100+'0';
& & & SendBuff[1]=46;
& & & SendBuff[2]=temp/10%10+'0';
& & &&SendBuff[3]=temp%10+'0';
& & & SendBuff[4]=32;
& & &&LED0=1;
& & & USART_DMACmd(USART1,USART_DMAReq_Tx,ENABLE); //使能串口1的DMA发送 &
& & & MYDMA_Enable(DMA1_Channel4);
& & &if(DMA_GetFlagStatus(DMA2_FLAG_TC4)!=RESET) //判断通道4传输完成
& & & & &&DMA_ClearFlag(DMA2_FLAG_TC4);//清除通道4传输完成标志
& & & & &&&
& & //delay_us(1500);
dbe41cb91ade5da4b6e09f6ce.jpg (0 Bytes, 下载次数: 0)
22:54 上传
2、DMA加延时1.5ms
& & & temp=adcx*100*(3.3/4096);
& & & SendBuff[0]=temp/100+'0';
& & & SendBuff[1]=46;
& & & SendBuff[2]=temp/10%10+'0';
& & &&SendBuff[3]=temp%10+'0';
& & & SendBuff[4]=32;
& & &&LED0=1;
& & & USART_DMACmd(USART1,USART_DMAReq_Tx,ENABLE); //使能串口1的DMA发送 &
& & & MYDMA_Enable(DMA1_Channel4);
& & &if(DMA_GetFlagStatus(DMA2_FLAG_TC4)!=RESET) //判断通道4传输完成
& & & & &&DMA_ClearFlag(DMA2_FLAG_TC4);//清除通道4传输完成标志
& & & & &&&
& & delay_us(1500);
cf3ef09f278b5f3ab1fef0_595.jpg (0 Bytes, 下载次数: 0)
22:54 上传
得到一周期也只有24个数据左右;
3,用查询的方法发送
u8 SendBuff[6];
void Uart1_PutChar(u8 ch)
&&USART_SendData(USART1, (u8) ch+'0');
& while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
void Uart1_PutChar1(u8 ch)
&&USART_SendData(USART1, (u8) ch);
& while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
int main(void)
u8 ah,al1,al2= 0;
LED_Init() ;
delay_init();
//延时函数初始化
uart_init(38400);&
Adc_Init();
//ADC初始化
Timer3_Configuration();
temp=adcx*100*(3.3/4096);
ah=temp/100;
Uart1_PutChar(ah);
Uart1_PutChar1(46);
al1=temp/10%10;
Uart1_PutChar(al1);
al2=temp%10;
Uart1_PutChar(al2);
Uart1_PutChar1(32);
f91a0f48cf950d76cff6a_514.jpg (0 Bytes, 下载次数: 0)
22:54 上传
得到的数据也只有27个左右。
附加信息:定时器定时1/(28*32)=1116us,串口波特率设为38400
请问原子哥,问题出现在哪里?到底怎样才能在串口调试助手里显示32个数据。谢谢您!
主题帖子精华
金钱115675
在线时间874 小时
回复【3楼】南方的狼:
---------------------------------
你采集完一次,再统一发送吧...
我是开源电子网站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺:
微信公众平台:正点原子& &
主题帖子精华
初级会员, 积分 121, 距离下一级还需 79 积分
在线时间5 小时
楼主,我看你采样点挺多的,你咋设置的呀,我用F4&ADC,1.4M的采样率去采样11KHz的,结果每个周期只有六个点,不知道咋回事
Powered by您所在位置: &
&nbsp&&nbsp&nbsp&&nbsp
基于matlab的数据采集系统的研究.doc 35页
本文档一共被下载:
次 ,您可全文免费在线阅读后下载本文档。
下载提示
1.本站不保证该用户上传的文档完整性,不预览、不比对内容而直接下载产生的反悔问题本站不予受理。
2.该文档所得收入(下载+内容+预览三)归上传者、原创者。
3.登录后可充值,立即自动返金币,充值渠道很便利
需要金币:100 &&
基于matlab的数据采集系统的研究
你可能关注的文档:
··········
··········
常 州 大 学
毕业设计(论文)
(2012届)
校内指导教师
专业技术职务
校外指导老师
专业技术职务
基于MATLAB的数据采集系统的研究
摘要利用数据采集卡构建的数据采集系统,一般价格昂贵,且难以完全匹配实际需求声卡作为数据采集卡,具有价格低廉、开发容易和系统灵活等优点?
本文介绍了基于MATLAB数据采集系统的开发背景、软件结构和特点,系统地分析了该数据采集系统的软硬件设计技术,利用声卡的A/D、D/A技术和MATLAB及其数据采集工具箱,?设计了数据采集与分析系统提出了一种基于声卡的数据采集与分析方案该方案实现简单、性价比高操作人性化,并且可以根据用户的需求进行功能扩展。最后给出了应用该系统采集数据的实例。利用该系统可实现在线连续采集语音信号并进行分析和处理。
关键词: MATLAB;声卡;数据采集
The research of Data Acquisition System Based On The MATLAB
Abstract:The data acquisition built by the data acquisition card, generally expensive, and difficult to exactly match the actual demand. However, sound card as a data acquisition card, possesses the advantages of low cost, developing easy and system flexibility, etc. This paper has discussed and designed a data collection and analysis system by taking sonic card of the computer as data acquisition card and MATLAB as the software platform.
This paper has specifically introduced the background of this topic, the structure and the characteristics of nowadays data collection system and gives a systematic analysis of the hardware and software design techniques of the data acquisition system. By using the A/D, D/A conversion technique of the sound card,MATLAB and its data collection toolbox, this paper has presented a cost-effective data collection and analysis design based on the sound card, and analyzed and described thoroughly the course and methods of data collection and analysis system The system has advantages of easy operating,a simple human-computer interface, making it more user-friendly and can also be extended according to the needs of users.
Finally, this paper has provided some examples which have applied this data
正在加载中,请稍后...分享给小伙伴们:
支持使用微薄、微信和QQ的账户登陆进行评论。由各自网站直接认证,不会泄露你的密码。
登陆后可选择分享评论到所绑定的社交网络,如微薄、人人和QQ空间。
评论提交后无法修改。如需修改,请删除原评论再重新提交。
评论支持,行内公式请用\(a+b=c\),行间公式请用\[a+b=c\]。公式只支持英文字符。
?:调出该窗口
←:阅读文章时,读(同一系列)下的前一篇文章
→:阅读文章时,读(同一系列)下的后一篇文章
Enter:回到上一层次
c:阅读已有评论
r:评论该文章
p:浏览该页面打印版
Ctrl+B:加粗
Ctrl+I:斜体
Ctrl+U:划线
Alt+Q:引用
Alt+L:添加链接

我要回帖

更多关于 matlab实时数据采集 的文章

 

随机推荐