Community Profile

photo

Fangjun Jiang


Last seen: Today
2,837 total contributions since 2011

What is a model?
Professional Interests: Model-Based Development

Contact

Fangjun Jiang's Badges

  • 36 Month Streak
  • Revival Level 3
  • First Review
  • Ace
  • Thankful Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
Limit a vector value
>> min([1 2 3],[2 0 5]) ans = 1 0 3 also see max()

19 hours ago | 0

| accepted

Answered
Incorrect use of '='
use "==" for equal compare. It is in the error message.

1 day ago | 0

| accepted

Answered
EVALIN cannot execute a return?
It seems that "return" was not executed in the "caller" workspace as it is supposed to by evalin(). But would a "regular" appro...

1 day ago | 0

Answered
How to repeat different vectors to form another vector?
repmat()

2 days ago | 0

| accepted

Answered
I cannot use the Fixed-point Tool when using dual-port RAMs in my design - strange bug
Internal "Idx1" traces back to input port "rd_addr". The error is complaining that the "rd_addr" can't be negative. In your mode...

2 days ago | 0

Answered
Changing the number of bits for a value
help fixdt

3 days ago | 0

Answered
Indexing n-th element with increasing offset.
%% a=1:13; b=cumsum(a); X=zeros(1,100); X(b)=1

3 days ago | 0

| accepted

Answered
How do I offset a vector plot?
V = 5:2:17; index=5:9; figure plot(index,V(index))

3 days ago | 0

Answered
Include of custom code in generated
Use this block? Model Header Block Model Source Block

3 days ago | 0

Answered
Delete a block and close an unconnected line with Ground & Terminator
delete_block() delete_line() addterms()

3 days ago | 0

| accepted

Answered
Importing workspace variable to simulink?
Use "From Workspace" block. Assume your data is MyData=1:10, you need to make it a column vector and also provide a column vecto...

3 days ago | 0

Answered
How to solve the discontinuity of MPC controller output?
Use a rate transition block or zero-order holder block to deal with different sample rate

3 days ago | 0

Answered
Retrieving the first time an enabled subsystem is triggered in Simulink
Within your "Parachute drag" enabled subsystem, feeding a constant of 1 to an Integrator block will give you the time since the ...

4 days ago | 0

| accepted

Answered
Search by line name
set 'FindAll' to be 'On' to search for signal lines. For outports, you need to clarify whether it is Outport block or outports o...

4 days ago | 0

Answered
Combining function handles into one function handle
>> a = @(x) x(1)^2+x(2)^2; b = @(x) x(3)^2-x(4)^2; >> a(1:4) ans = 5 >> b(1:4) ans = -7 >> c = @(x) [x(1)^2+x(2...

5 days ago | 0

Answered
Simulink: Need to update variables used in simulink differential equation solver
Do you have the formula of the function? For example, if pe1(t)=sin(t), you just use the "Fcn" block, specify it as "sin(u)" and...

13 days ago | 0

Answered
How to use double precision functions in a single precision code generated project?
It is not a matter of double or single. The supported data types for this block is "Supported data types: Fixed-point, integer (...

13 days ago | 0

Answered
How to combine cells from cell array with a loop
data{1}=magic(3); data{2}=rand(2,3); data{3}=ones(4,3); cell2mat(data.')

13 days ago | 0

| accepted

Answered
How to create a 5D matrix by repeating a 2D array?
A has 70*70 elements. The loop runs only 70 times. Anyway, look into repmat(), reshape(),repelem().

13 days ago | 0

| accepted

Answered
Restoring model operating point and resetting time
Utilize the "Initial State" and "States" in Configuration Parameters, Data Import/Export. Basically, log the "States" of one sim...

14 days ago | 0

Answered
How to create a structure of time series at one time
It can be done but it would be tedious. I would suggest one of these Use "State Reader" and "State Writer" block in Simulink Si...

14 days ago | 0

Answered
Simulink: Need help using simulation time as a variable in Simulink Calculations
Use the Clock block from Simulink Sources.

15 days ago | 0

| accepted

Answered
How to take a max of a value in a struct
One way to do this PropertyNames={'Name','Weight','Strength'}; Data={'Metal',100,100; 'Plastic',50,50; 'Paper',1...

16 days ago | 0

Answered
Variable names in array2table when creating table, "duplicate variable names" error
No way to know what is in "master". But there is a duplicated name in 'parameters'. The name 'TimeofSootSpikeEnd_sec' appeared t...

16 days ago | 0

Answered
Combination of rows of two different matrices
Feels non-ideal. Any better solution? >> C=A(:,1)+B(:,1)'; D=A(:,2)+B(:,2)'; reshape([C(:),D(:)],[],2) ans = -1.0000 -...

17 days ago | 1

| accepted

Answered
Can the integration method be changed for discrete PI controller block from motor control blockset?
A DiscreteIntegrator block has that option. You just have to change it yourself if it is available. Of course then you will be d...

17 days ago | 0

Answered
Double Pendulum Simulation using Simulink
The best way for this is to use the Constant block. You can specify the value of the Constant block as "m1" where "m1" is the va...

17 days ago | 1

Answered
Different behaviour of hold on depending on order
Good catch! From the document of hold "If axes do not exist, then the hold command creates them." Without an existing axes, "h...

17 days ago | 0

Answered
HOW TO INCREASE NUMBER OF PORTS IN SCOPE IN MATLAB (2007)
Probably don't have that capability. The current Scope block is originated in R2015b. What you can do is to use a Mux block to ...

18 days ago | 0

Load more