0

I have tried to draw a block diagram in Simulink that has annotation fields. Then I have exported it in eps format from Matlab command window:

print -deps -r300 -s resolver.eps  

The picture looks like this:

enter image description here

I would like to change text in block diagram with greek letters, so I used \psfrag, but with no success. I have also opened the .eps file with editor and searched for text (U_sin, U_cos, theta, omega), but there are no such texts in the generated .eps file, so I thik \psfrag just can't replace anything. Does somebody have the solution?

\begin{figure}[h]
    \centering
    \psfrag{U_sin}{$\U_{sin}$}
    \psfrag{U_cos}{$\U_{cos}$}
    \psfrag{omega}{$\hat{\omega}$}
    \psfrag{theta}{$\hat{\theta}$}
    \includegraphics[width=0.75\columnwidth]{resolver2}
     \caption{\label{resolver1} Blokovna shema metode Angle Tracking Observer}
\end{figure}

EDIT:
I have imopted eps file into Inkscape and obviously there is the text information in the eps file as Inkscape recognize it, I have changed text into math form for LaTex and saved with option EPS + LaTex, using command \import in latex I got this.
enter image description here

  • I don't know simulink but if -r300 denotes writing a 300dp bitmap then it's a bitmap just wrapped in a postscript shell so it will not be amenable to editing. If all else fails just write it from simulink with no text at all and then overlay the latex text by coordinate – David Carlisle May 17 '16 at 18:23
  • @DavidCarlisle I tried without -r300 option, but same result. I don't fully understand the eps file format, so I thought it is kind of usefull format, since LaTex has psfrag command. Thanks anyway for the tip, about to insert overlay text. – Marko Buršič May 17 '16 at 19:19
  • @MarkoBuršič can we see that EPS generated by simulink? Just to see what exactly it is that is being generated. Psfrag need some very particular conditions in order to work. Also remember \cos and \sin – daleif May 18 '16 at 10:45
  • @daleif I don't see the possibility to attach file in this forum, if that is what you are asing for. The file is 56kB. – Marko Buršič May 18 '16 at 10:54
  • 1
    @MarkoBuršič it is a rather strange eps. Clearly not suited for psfrag. The fonts are handled "interestingly" and you are correct the strings psfrag could have searched for are nowhere to be found. Might even be easier to just redo the image in tikz. The base drawing for this image is very easy to make, and would problably end up looking better (are the arrows manually placed in this program? For example the arrow from the dot to K2 is off center in regards to the dot. – daleif May 18 '16 at 12:04
3

This is just a long comment about doing the drawing in tikz instead. Here are some starting points given without comments, most is explained in the tikz manual, plus there are loads and loads of tikz answers on this site:

\documentclass[a4paper]{standalone}
\usepackage{tikz,amsmath}
\usetikzlibrary{calc,shapes,shapes.geometric}



\begin{document}

\tikzset{
  myBox/.style={
    draw,
    minimum height=6mm,
    minimum width=6mm,
  },
  myCircle/.style={
    draw,
    circle,
    inner sep=0pt,
    minimum height=6mm,
    minimum width=6mm,
  },
  myTriangle/.style={
    draw,
    %isosceles triangle,
    regular polygon, 
    regular polygon sides=3,
    shape border rotate=-90,
    inner sep=0pt,
    minimum width=6mm,
  }
}
\begin{tikzpicture}
  \node[myBox] (T1) at (0,0) {$X$};
  \node[myBox] (T2) at ($(T1)+(0,-3)$) {$X$};
  \node[myCircle] (T3) at ($(T1)!0.5!(T2)+(1,0)$) {$\genfrac{}{}{0pt}{}{+}{-}$};
  \node[myBox] (T4) at ($(T2)+(0,-1)$) {$\sin$};
  \node[myTriangle] (T5) at ($(T3)+(1.5,0)$) {$K_1$};

  \coordinate (T6) at ($(T3.east)!0.5!(T5.west)$);
  \fill (T6) circle (2pt);

  \begin{scope}[shorten >=1pt,shorten <=1pt]
    \draw[->] (T1) -| (T3);
    \draw[->] (T2) -| (T3);
    \draw[->] (T4.west) -- ++(-0.5,0) |- (T1.west);
    \draw[->] (T3) -- (T5);
    % start from the center of the dot
    \draw[shorten <=0pt,->] (T6) |- (T4);
  \end{scope}

\end{tikzpicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.