matlab

MATLAB slider step behavior

徘徊边缘 提交于 2021-02-18 05:07:12
问题 I have a created a slider widget using GUIDE in MATLAB 2012a. I want it to control an axis that displays images inwhich the slider steps through a sequence of them. I have set the slider's properties for Min, Max, and SliderStep in one part of the m-file. sliderMin = 1; sliderMax = size(result); % this is variable sliderStep = [1, 1]; % major and minor steps of 1 set(handles.slider, 'Min', sliderMin); set(handles.slider, 'Max', sliderMax); set(handles.slider, 'SliderStep', sliderStep); set

call a matlab script in a script

冷暖自知 提交于 2021-02-18 04:55:36
问题 I have two matlab script files .m (not function files) and if I want to call another script in my current script, which command should I use? Thank you. 回答1: I found the answer. Just name the script in the other script: myOtherScript You can use run('myOtherScript') if you prefer, but it will end up internally doing the same thing as naming it directly; you might, though, like the emphasize that it gives that it is a script being mentioned. 回答2: If you want to pass parameters to it, enclose

call a matlab script in a script

半世苍凉 提交于 2021-02-18 04:54:54
问题 I have two matlab script files .m (not function files) and if I want to call another script in my current script, which command should I use? Thank you. 回答1: I found the answer. Just name the script in the other script: myOtherScript You can use run('myOtherScript') if you prefer, but it will end up internally doing the same thing as naming it directly; you might, though, like the emphasize that it gives that it is a script being mentioned. 回答2: If you want to pass parameters to it, enclose

call a matlab script in a script

本小妞迷上赌 提交于 2021-02-18 04:53:42
问题 I have two matlab script files .m (not function files) and if I want to call another script in my current script, which command should I use? Thank you. 回答1: I found the answer. Just name the script in the other script: myOtherScript You can use run('myOtherScript') if you prefer, but it will end up internally doing the same thing as naming it directly; you might, though, like the emphasize that it gives that it is a script being mentioned. 回答2: If you want to pass parameters to it, enclose

ST的电机控制平台

荒凉一梦 提交于 2021-02-18 04:00:17
电机控制历来是芯片半导体厂家的必争之地,在公众号里多次介绍过NXP的电机控制平台,从直流无刷,到永磁同步到交流异步,包括项目中的使用探讨情况,最近在用ST的片子,ST同样提供很好的电机控制和参考设计平台, 通过装载电机控制SDK的设计文件可以生成工程,根据需要进行裁剪和参考 很形象化的从拓扑到结构和芯片的选择,管脚定义都有很好的参考。降低了许多刚入门电机控制的工程师的门槛。但是如果想控制好电机,还是要对基础理论很清楚,但这些工具确实能够很好的帮到你快速完成搭建和验证,在配合MATLAB/simulink那更是如虎添翼。 生成的工程也很清晰,划分也很符合模块化设计的规则,是很好的电机控制参考工程。 有兴趣的可以对比下我们之前介绍的NXP的平台和ST的平台,根据你的需要合理选择和使用,同时参考一些设计中的考虑和分析。这些图像化的设计工具确实会帮助我们节省很多时间。设计中可以多借鉴一些成熟的工具和软件件。提升设计的速度和交付的周期。现在的许多电机控制的项目都可以采用官方提供的工具和MATLAB的工具很好的完成,而且减少了很多工程师设计的时间。尤其随着这几年基于模型的设计,越来越多的设计项目可以采用一系列的工具来完成。其实编写代码只是我们设计中很小的一个环节,而相反我们设计中的工作,思维的体现,模型的搭建和验证才是重点。 本文分享自微信公众号 - 嵌入式程序猿(InterruptISR)。

Interpreting (and comparing) output from numpy.correlate

自闭症网瘾萝莉.ら 提交于 2021-02-18 03:04:58
问题 I have looked at this question but it hasn't really given me any answers. Essentially, how can I determine if a strong correlation exists or not using np.correlate ? I expect the same output as I get from matlab's xcorr with the coeff option which I can understand (1 is a strong correlation at lag l and 0 is no correlation at lag l ), but np.correlate produces values greater than 1, even when the input vectors have been normalised between 0 and 1. Example input import numpy as np x = np

Interpreting (and comparing) output from numpy.correlate

只愿长相守 提交于 2021-02-18 03:04:50
问题 I have looked at this question but it hasn't really given me any answers. Essentially, how can I determine if a strong correlation exists or not using np.correlate ? I expect the same output as I get from matlab's xcorr with the coeff option which I can understand (1 is a strong correlation at lag l and 0 is no correlation at lag l ), but np.correlate produces values greater than 1, even when the input vectors have been normalised between 0 and 1. Example input import numpy as np x = np

Split the dataset into two subsets in matlab/octave [closed]

丶灬走出姿态 提交于 2021-02-17 07:19:04
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . Improve this question Split the dataset into two subsets, say, "train" and "test", with the train set containing 80% of the data and the test set containing the remaining 20%. Splitting means to generate a logical index of length equal to the number of observations in the dataset, with 1 for a

Calculate Euclidean distance matrix in C

本小妞迷上赌 提交于 2021-02-17 06:37:27
问题 I would like to convert this code which is written in MATLAB to C: matrix = [1 2 3; 4 5 6; 7 8 10] dis=zeros(9); for i=1:3 for j=1:3 dis(i,j)=sqrt(sum (abs((matrix(i,:)-matrix(j,:))))^2); end end The output is as follows: 0 9 19 9 0 10 19 10 0 Here is what I came up with in C: #include <stdio.h> #include <math.h> int main() { double distance[3][3] = {0}; double myArray[3][3] = { {1, 2, 3}, {4 , 5, 6}, {7, 8, 9} }; int i, j; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { distance[i][j] =

No visible points for plot in for loop

依然范特西╮ 提交于 2021-02-17 06:19:37
问题 I'm struggling with a plot I want to make using a for-loop. I know it works when I add it after the loop (just a simple plot). But I want to try it in this other way. fib = ones(1:10); for k=3:10 hold on fib(k) = fib(k-1) + fib(k-2); plot(k,fib(k)) end hold off The output is a plot, but there are no points visible. 回答1: You need to specify a marker. The documentation says: If one of X or Y is a scalar and the other is either a scalar or a vector, then the plot function plots discrete points.