Community Profile

# Fangjun Jiang

##### Last seen: Today
2.685 total contributions since 2011

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

#### Fangjun Jiang's Badges

View details...

Contributions in
View by

ressistors with small random offset in SIMULINK
click the "Variables" tab?

circa 10 ore ago | 0

isempty is allways zero
zero and empty are different isempty([]) isempty(0) isempty('')

circa 11 ore ago | 0

| accepted

Eliminate certain entries of cell array
Would it possible to make it array? a=1:5; b=1:3; a=setdiff(a,b)

circa 15 ore ago | 0

Stop Simulink simulation when reached an oscillating steady state amplitude
If you have this toolbox and can use this block, maybe you can look at the rate of change of the magnitude. Sinusoidal Measurem...

circa 15 ore ago | 0

How to run a Simulink simulation using keyboard
Ctrl+T Keyboard and Mouse Actions for Simulink Modeling

circa 15 ore ago | 0

| accepted

Taking element of matrix from state space model of plant
Use the DeMux or BusSelector block

circa 17 ore ago | 0

can a new function be defined in the middle of livescript?
No. %% a=1; function out=timestwo(in) out=in*2; end b=timestwo(a) Error: File: Untitled Line: 8 Column: 1 Function d...

1 giorno ago | 0

| accepted

Problem with the use of find(diff...>1))
just run diff(Xr) first and you will see why

1 giorno ago | 0

| accepted

How can I delete a particular element in a set of workspace variables?
For a one-time processing, you can do this for r = 1:length(C) if C(r).size(1)>839 str=sprintf('%s(840:end)=[];',...

1 giorno ago | 0

how to make the sum of all centroids?
Feed your "Centroid" signal to a "Sum" block, connect the output of "Sum" to a "Unit Delay" block, connect the output of "Unit D...

1 giorno ago | 0

How do I rerun a Simulink model?
In general, most Simulink blocks support vector and array input. For example, the multiply (Product) block supports element-wise...

1 giorno ago | 0

| accepted

save a fprintf as text file
fid=fopen('MyTextFile.txt','wt'); fprintf(fid,...); fclose(fid);

3 giorni ago | 0

| accepted

Saturating Functions at a certain value
x=[0:0.01:20]; expo=@(x) min(2.^x,100); plot(x,expo(x));

5 giorni ago | 0

Is it possible to create a library of Model Reference blocks?
It is possible but based on what you described, I would say a library of subsystem blocks are better than a library of model ref...

5 giorni ago | 0

How to create a block diagram that will increment a value?
A counter block, multiplied by 0.1 or -0.1

6 giorni ago | 0

| accepted

how to get simulink stop time even if using code generation
Not sure what you mean. >> vdp >> get_param('vdp','StopTime') ans = '20'

6 giorni ago | 0

Triggering blocks on simulink
It sounds right. Comparing a with 0.75 and 0.85 will generate two high or low logical signals. Combine these two logical signals...

7 giorni ago | 0

How do you change the port names in a lookup table programatically?
You can't change the lable "u1", "u2". They are just to identify the first dimention input, 2nd dimension input, etc. They have ...

7 giorni ago | 0

Re-arrange cell accordingly to a sorted vector
utilizde another output of sort(). Note legend() is a function. [newY, index]=sort(Y) newLegend=oldLegend(index)

8 giorni ago | 1

| accepted

Cell rows/columns size

8 giorni ago | 0

| accepted

Ways to define 'data store memory' block
This is on that page. Create A=Simulink.Signal in base workspace, then you can use DataStoreRead or DataStoreWrite block with da...

8 giorni ago | 0

Distributing a cell array into another
strcat(repmat(A,size(B')),repmat({' '},[length(B),length(A)]),repmat(B',size(A)))

9 giorni ago | 0

Execution Time Calculation in Simulink
Like this? tic; sim('MyModel'); toc;

9 giorni ago | 0

Passing the Value as Argument but not getting it in the function file
In your function, you need to assign or return iNew,jNew

9 giorni ago | 0

Removing loaded variables from workspace after changing name with eval
Use one example, figure out if you can use the code below. If not, use "clear" to delete variable from workspace. Patient=load(...

9 giorni ago | 0

is it a normal display of the command window on MATLAB for window? and how to fix if it needs attention?
Some of the folders must have been moved or deleted. Run "restoredefaultpath" and re-start MATLAB.

10 giorni ago | 0

Changing model programmatically: discard changes and exit?
close_system(sys,saveflag)

10 giorni ago | 0

| accepted

dec2bin is adding inappropriate 0s to negative numbers when numBits is specified
Report to tech support. I think it looks like a bug. From "doc dec2bin" in R2020a Starting in R2020a, the dec2bin function con...

10 giorni ago | 0

| accepted

how to store coordinate values xy[] for randomly generate point
Try one-liner, no loop. xy=[xm*rand(NumOfNodes,1), ym*rand(NumOfNodes,1)]

12 giorni ago | 0

| accepted