Beantwortet
How to use Matlab script to find all the testpoints in Simulink model??
%% MyModel='f14'; open_system(MyModel); Lines=find_system(MyModel,'FindAll','On','LookUnderMasks','All','FollowLinks'...

fast 15 Jahre vor | 3

| akzeptiert

Beantwortet
How to plot overlapping parallel lines with a small offset to make them all visible?
plot() or stairs() can't do that, as others might just want the opposite. You have to process it yourself by adding an offset, ...

fast 15 Jahre vor | 0

Beantwortet
Time axes (horizontal axes) range of Scope
By default, the Scope block has a limit of 5000 data points. Change the Scope parameters in the "Data History" tab to allow more...

fast 15 Jahre vor | 2

| akzeptiert

Beantwortet
Is it possible in Scope to plot 2 signals together and overhand?
Use the "Mux" block from the "Signal Routing" library to combine the two signal together into a vector signal and then feed it t...

fast 15 Jahre vor | 2

| akzeptiert

Beantwortet
fwrite do not write numbers 1-32
You are right, file ID 1 is the standard output. You are writing binary numbers but the standard output only shows the correspon...

fast 15 Jahre vor | 0

Beantwortet
Simulink problem Vout/Vin
Use the <http://www.mathworks.com/help/toolbox/simulink/slref/xygraph.html XY Graph Block>. Feed Vin to X port and Vout to Y por...

fast 15 Jahre vor | 1

Beantwortet
matrix addition
A=rand(3,4,5); B=sum(A,3); % sum at the third dimension.

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Load----problem in using this commad
Try this first to see if it is the problem regarding your file name construction. for i=1:100 fnam=sprintf('F%03d.tx...

fast 15 Jahre vor | 2

Beantwortet
matlab path
What is your function name? Do you have a conflict with other functions or variable names. Try to use which command. which ...

fast 15 Jahre vor | 0

Beantwortet
adding elements in a loop into an array
Use x=[x;window_size]; or a better way, if num_windwows>0 x=zeros(num_windwows,1); else error('Invalid number of...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Change port numnber set_param('In1', 'Port', 8)
You need to use the full path of the block and set string format for the port number. Also, you might need to consider duplicate...

fast 15 Jahre vor | 1

Beantwortet
Need a quick help on storing words according to lengths with struct
You have to use wordstruct.L4, wordstruct.L5, etc. as '4L','5L' etc. are not valid name. cellfun('islength',...) and then a for...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Problem compiling a GUI
What do you mean by "when I try open it"? If you've got an executable (*.exe file), you should run it in Windows Command Window,...

fast 15 Jahre vor | 0

Beantwortet
Undefined function or variable "xa" error message
In the Simulink model, press Ctrl+F, search where the variable 'xa' is used. Then assign a proper value to 'xa' in MATLAB Comman...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
how to access 5 values in an array at a time?
You can use reshape() and mean() to avoid the for-loops. %% A=magic(10); % if you want to do average of 5, row-wise B=A...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Vectorising setting values of array by reading from other array
x_arr=zeros(1000,1); arr=[45;56]; x_arr(arr)=1; You can't use 'x-arr' as it regards '-' as the minus operator.

fast 15 Jahre vor | 1

| akzeptiert

Beantwortet
avoiding same data in looping
For A=1:3 fprintf('The value of A is: %d\n',A); end

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Simulink - Find computed index of multidimensional signal at specific time
I don't think you can do that. In the generated code, you will see there is a for-loop to do that vector summation. But it's not...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Reading from many columns of an excel sheet
Can you explain why you don't use xlsread() directly? A=rand(10); xlswrite('test.xls',A,'FirstSheet','B2'); B=xlsread('test.x...

fast 15 Jahre vor | 0

Beantwortet
Labelling biograph figures
try title('This is my figure') Or maybe text(). Or you need to clarify your question. Providing an example to explain your que...

fast 15 Jahre vor | 1

Beantwortet
How can we let Matlab to choose the decimal place?
Something like this? %% Value=pi; Err=0.00356; Str=sprintf('%1.0e',Err); Err=str2double(Str) D=str2double(Str(3:end...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Everytime I try to plot, I get a straight line, and not a sine wave:(
For the exact value y, you need to do y=exp(t/2).*sin(5*t) t is a vector, t(i) is the individual element depending on the ...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Initial Value of y(0)=0
Unlike C language, MATLAB uses 1-based index for vector and matrix. So if you define a 10x1 vector, a=rand(10,1), you refer it a...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
fscanf in Simulink
Simulink doesn't support string data type. See <http://www.mathworks.com/help/toolbox/simulink/ug/f14-90479.html#f14-90488> Y...

fast 15 Jahre vor | 0

Beantwortet
Create a function from user input string
>> str='x^2+2*x+3' str = x^2+2*x+3 >> f=inline(str) f = Inline function: f(x) = x^2+2*x+3 >> f(2) an...

fast 15 Jahre vor | 3

| akzeptiert

Beantwortet
assigning a probability to a loop
See this post. <http://www.mathworks.com/matlabcentral/answers/14585-random-number-generation-with-changing-probability random n...

fast 15 Jahre vor | 0

Beantwortet
Make Error in Simulink – Division by Zero?
I assume you understand what is division by zero error. Every time you do a division, in C or in MATLAB, the safest way is to ch...

fast 15 Jahre vor | 0

Beantwortet
histogram plotting issue
You need to learn to use vector or matrix, the essence of MATLAB. Pre-allocate you p as p=.1:.1:.9; p will be a 1x9 vector, y...

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Displaying % error
%% t=1:10; y=1:10; str=cellstr(num2str(y.','%%%5.2f')); plot(t,y); text(t,y,str);

fast 15 Jahre vor | 0

| akzeptiert

Beantwortet
Calculating and Adding Percent Error to a Graph
Since you have the y and ystar, you can do percent_error=100*abs(y-ystar)./y; Notice "./" is the element-wise division....

fast 15 Jahre vor | 0

| akzeptiert

Mehr laden