Réponse apportée
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, ...

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 1

Réponse apportée
matrix addition
A=rand(3,4,5); B=sum(A,3); % sum at the third dimension.

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 2

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

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 1

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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,...

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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.

plus de 14 ans il y a | 1

| A accepté

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

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 1

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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 ...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 3

| A accepté

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

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 0

Réponse apportée
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...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Displaying % error
%% t=1:10; y=1:10; str=cellstr(num2str(y.','%%%5.2f')); plot(t,y); text(t,y,str);

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
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....

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Cutting down on space while generating code.
I assume you are using RTW. Follow the documentation Real-Time Workshop->User's Guide->Preparing Models for Code Generation->Con...

presque 15 ans il y a | 0

| A accepté

Charger plus