Community Profile

photo

Fangjun Jiang


Last seen: Today
2,823 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
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...

19 hours 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...

9 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 (...

9 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.')

9 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().

9 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...

10 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...

10 days ago | 0

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

11 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...

12 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...

12 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 -...

13 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...

13 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...

13 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...

13 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 ...

14 days ago | 0

Answered
Renaming files in a folder in bulk
>> name='AB007_group2_subject011_naive_day2_rawdata.mat' name = 'AB007_group2_subject011_naive_day2_rawdata.mat' >> name=...

14 days ago | 0

| accepted

Answered
how to save variables
xlswrite('MyFile.xlsx',[product, TIS, error, error2])

14 days ago | 0

| accepted

Answered
issue in find variable
floating point data precision issue. Below is an example, a and b are not equal even though all the visible digits are the same....

14 days ago | 0

Answered
How can i use If ... else loop inside function ?
If none of those conditions are met, you end up with z not assigned. give z a default value at the begining.

15 days ago | 0

| accepted

Answered
Does your maintenance include security updates
Yes. Pay attention to the Bell icon on the top right corner of your MATLAB. There will be a reminder/notification when there is ...

15 days ago | 0

Answered
Setting initial condition of simulink integrator through code
The error message says you have the dialog window open and changes have not been applied. Click apply or Ok and then proceed.

15 days ago | 0

Answered
How to send a value to position "i" from app designer to a constant block in Simulink that has 5 dimmensions?
It certainly can be done but I am not sure if it would be "better". Note you have to set 'Value' as '5', not 5. when you set t...

15 days ago | 0

| accepted

Answered
Simulink, data from vector representation.
The most common case, let's say you have a vector a=0:0.1:1. Make it a column vector b=a' Create a time vector to specify the ...

15 days ago | 0

Answered
Changing function packaging of Simulink Functions to inlined
Inline would make that block a regular subsystem block, not a Simulink Function. A Simulink Function is called by its name, so I...

16 days ago | 0

Answered
Reactivate Matlab with different license
Most likely, you won't be able to launch MATLAB on your slower computer. Otherwise, you could go to Help, Licensing, Activate So...

16 days ago | 0

Answered
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
Add % before ... if you mean to add comment. "..." is used to continue another line, but your next line is new assignment.

16 days ago | 1

| accepted

Answered
Why is cyclomatic Complexity of Switch Block 2?
A Switch block is an equivilant of an if-else statement. Its cyclomatic complexity number is 2.

16 days ago | 1

Answered
Increment and decrement counter
Use a 'Unit Delay' block. That is the counter. Add a number to it. The number is either 1 or -1. Use S-R Flip-Flop block to ge...

17 days ago | 0

Answered
finding elements in a vector from another vector
[~,y]=ismember(x,m)

18 days ago | 0

Load more